-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit script to create new score #3335
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
src/main/scripts/releases/4.1/adhoc/createNewResearchAndDevelopmentScore.js
This file contains 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
load('../../utils/audit.js'); | ||
let adminUserId = '<tbd>' | ||
let scores = [ | ||
{ | ||
scoreId: UUID.generate(), | ||
entityTypes: undefined, | ||
tags: [], | ||
displayType: '', | ||
entity: 'Activity', | ||
outputType: 'Research and Development', | ||
isOutputTarget: false, | ||
category: 'Reporting', | ||
status: 'active', | ||
label: 'Invoiced number of hours conducting research and development', | ||
description: '', | ||
configuration: { | ||
childAggregations: [ | ||
{ | ||
filter: { | ||
property: 'name', | ||
filterValue: 'NHT - Research and development', | ||
type: 'filter' | ||
}, | ||
childAggregations: [ | ||
{ | ||
property: 'data.noHoursConductingResearchAndDevelopmentInvoiced', | ||
type: 'SUM' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
, | ||
{ | ||
_id: ObjectId('664c25abb61a6108c799ea73'), | ||
scoreId: UUID.generate(), | ||
label: 'Number of hours conducting research and development', | ||
status: 'active', | ||
isOutputTarget: true, | ||
category: 'RLP and Bushfire Recovery', | ||
outputType: 'Research and Development', | ||
configuration: { | ||
childAggregations: [ | ||
{ | ||
filter: { | ||
property: 'name', | ||
filterValue: 'NHT - Research and development', | ||
type: 'filter' | ||
}, | ||
childAggregations: [ | ||
{ | ||
property: 'data.noHoursConductingResearchAndDevelopment', | ||
type: 'SUM' | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
dateCreated: ISODate('2024-12-17T04:40:11.160Z'), | ||
lastUpdated: ISODate('2024-12-17T04:40:11.160Z') | ||
}]; | ||
|
||
|
||
for (let i=0; i<scores.length; i+=2) { | ||
let invoiced = scores[i]; | ||
let delivered = scores[i+1]; | ||
|
||
audit(invoiced, invoiced.scoreId, 'au.org.ala.ecodata.Score', adminUserId, null, 'Insert'); | ||
db.score.insertOne(invoiced); | ||
|
||
} |
e126ed4
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.
Hi @chrisala when you have a chance can you please review the script for the creation of new score for Research and/or Development service. Thank you.
e126ed4
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.
Looks fine @salomon-j except the "actual" score needs an extra field to link it to the invoiced score or they won't appear combined on the dashboard.
relatedScores: [
{
description: 'Invoiced by',
scoreId: '<id of invoiced score>'
}
]
e126ed4
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.
@chrisala thank you. I've made the updates and already ran the script in test.