-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/sof 5462 - get name from file content #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adewyer
wants to merge
7
commits into
epic/SOF-5386
Choose a base branch
from
feature/SOF-5462
base: epic/SOF-5386
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e13d02d
Updates for setting file name based on file contents instead of name
adewyer 9e46b96
added test for new poscar feature that returns material name based on…
adewyer b42852d
update cicd.yml file to fix broken tests
adewyer d27aa01
added function to get xyz file name from contents
adewyer efc4f7c
updated materialNameFromFileContent function --> getNameFromContents
adewyer 64be7d5
removed double export in parsers/utils.js, and updated function to re…
adewyer 8064efa
adjusted logic for getting file name from contents
adewyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,10 +140,26 @@ function fromMaterial(materialOrConfig, fractional = false) { | |
return fromBasis(basis, "%11.6f"); | ||
} | ||
|
||
/** | ||
* Function returns the string on the second line of XYZ file content. Generally the second line contains text | ||
* containing the name of the structure. | ||
* @param {String} name | ||
* @param {String} fileContent | ||
* @returns {String} | ||
*/ | ||
export function materialNameFromFileContents(name, fileContent) { | ||
const materialNameFromFile = fileContent.split(/\r?\n/)[1]; | ||
if (name === materialNameFromFile || !materialNameFromFile) { | ||
return name; | ||
} | ||
return materialNameFromFile; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
export default { | ||
validate, | ||
fromMaterial, | ||
toBasisConfig, | ||
fromBasis, | ||
CombinatorialBasis, | ||
materialNameFromFileContents, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown
Git LFS file not shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.