-
Notifications
You must be signed in to change notification settings - Fork 40
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
OHRI-1963 Enable editing of L&D form infant details in OHRI #1689
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { getIdentifierInfo } from '../api/api'; | ||
|
||
export const generateInfantPTrackerId = (fieldId: string, motherPtrackerId: string): string | undefined => { | ||
if (!fieldId || !motherPtrackerId) return; | ||
return fieldId === 'infantPtrackerid' | ||
? motherPtrackerId + '1' | ||
: fieldId.includes('_') | ||
? motherPtrackerId.concat((Number(fieldId.split('_')[1]) + 1).toString()) | ||
: undefined; | ||
}; | ||
|
||
export const getIdentifierAssignee = (identifier: string, identifierType: string) => { | ||
return getIdentifierInfo(identifier).then((data) => { | ||
if (data) { | ||
for (const result of data.results) { | ||
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. What happens if 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. This comment also applies to the lines below, you better explicitly check or add the question marks 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. In this case, by the time we get here, all the other possible errors were checked and the call is fine. If there's no data, it only means that there's no patient with that identifier meaning it's ok to go ahead and assign it to the current patient. |
||
for (const identifierObj of result.identifiers) { | ||
if (identifierObj.identifier === identifier && identifierObj.identifierType.uuid === identifierType) { | ||
return result.person; | ||
} | ||
} | ||
} | ||
return {}; | ||
} | ||
return {}; | ||
}); | ||
}; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌🏿