Skip to content

Commit

Permalink
commit script to create new score #3335
Browse files Browse the repository at this point in the history
  • Loading branch information
salomon-j committed Dec 17, 2024
1 parent 227542c commit e126ed4
Showing 1 changed file with 72 additions and 0 deletions.
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);

}

3 comments on commit e126ed4

@salomon-j
Copy link
Contributor Author

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.

@chrisala
Copy link
Collaborator

@chrisala chrisala commented on e126ed4 Dec 17, 2024

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>'
}
]

@salomon-j
Copy link
Contributor Author

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.

Please sign in to comment.