Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/study/arrival.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<column columnName="Id"/>
<column columnName="date">
<columnTitle>Arrival Date</columnTitle>
<formatString>DateTime</formatString>
</column>
<column columnName="arrivalType">
<columnTitle>Arrival Type</columnTitle>
Expand Down
1 change: 0 additions & 1 deletion nirc_ehr/resources/queries/study/birth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function onInit(event, helper){
skipHousingCheck: true,
announceAllModifiedParticipants: true,
allowDatesInDistantPast: true,
removeTimeFromDate: true,
skipAssignmentCheck: true,
});

Expand Down
1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/study/birth.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</column>
<column columnName="date">
<columnTitle>Birth Date</columnTitle>
<formatString>DateTime</formatString>
</column>
<column columnName="cage">
<columnTitle>Birth Location</columnTitle>
Expand Down
18 changes: 10 additions & 8 deletions nirc_ehr/resources/queries/study/deaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,21 @@ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Even
});

EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.COMPLETE, 'study', 'Deaths', function(event, errors, helper){
// A delete arrives here as the deleted row with a null oldRow, which otherwise reads as a draft leaving draft.
if (event === 'delete')
return;

var rows = helper.getRows() || [];
for (var i = 0; i < rows.length; i++) {
var row = rows[i].row;
var oldRow = rows[i].oldRow;

// Notification will get sent when:
// 1) a brand-new row saved directly as 'Request: Pending' (i.e., when a user clicks 'Submit Death'), or
// 2) a draft death record moving from 'In Progress' to 'Request: Pending'.
if (!helper.isETL() &&
row && row.Id &&
row.QCStateLabel &&
row.QCStateLabel.toUpperCase() === 'REQUEST: PENDING' &&
(!oldRow || !oldRow.QCStateLabel || oldRow.QCStateLabel.toUpperCase() === 'IN PROGRESS')) {
if (helper.isETL() || !row || !row.Id || !row.QCStateLabel)
continue;

// Notify once, on the first non-draft save: 'Submit Death' lands on 'Request: Pending', but a death entered alongside its necropsy goes straight to 'Review Required' or 'Completed'.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was by design, since Submit Death was meant to notify the relevant users so they could complete the Necropsy. When Death and Necropsy are submitted together, the Necropsy is already entered, so the notification seems moot in that case. But I could be missing some additional context now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what they've asked for now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The submit death allows AR to notify VR of a pending necropsy but VR can do a straight necropsy and now AR is not notified. The AR managers are in the death notification list but a two step process is undesired for VR (submit death for email, then submit necropsy for review). The head vet still has to submit final regardless of either path.

var wasDraft = !oldRow || !oldRow.QCStateLabel || oldRow.QCStateLabel.toUpperCase() === 'IN PROGRESS';
if (wasDraft && row.QCStateLabel.toUpperCase() !== 'IN PROGRESS') {
console.log("Sending NIRC Death Notification")
triggerHelper.sendDeathNotification(row.Id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Ext4.define('NIRC_EHR.window.DeathNecropsySubmitForReviewWindow', {
text: 'Cancel',
scope: this,
handler: function(btn){
btn.up('window').hide();
btn.up('window').close();
}
}],
items: [{
Expand All @@ -127,8 +127,10 @@ Ext4.define('NIRC_EHR.window.DeathNecropsySubmitForReviewWindow', {
value: this.getDefaultRecipient(),
displayField: 'DisplayName',
valueField: 'UserId',
// No global 'id' here: a reopened window would adopt the previous window's element and render a second combo.
itemId: 'assignedTo',
id: 'assignedTo',
// Ext derives the input's name from the component id when 'name' is absent, so set it explicitly rather than leaning on the id.
name: 'assignedTo',
anyMatch: true,
caseSensitive: false,
}]
Expand Down