Skip to content

Commit

Permalink
Don't retrieve monitoring protocols unless necessary #2928
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Aug 1, 2023
1 parent 979d228 commit 2127a41
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions grails-app/assets/javascripts/meriplan.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,18 @@ function MERIPlan(project, projectService, config) {
self.keyThreatCodes = config.keyThreatCodes || [];
self.priorityPlaces = config.priorityPlaces || [];
self.monitoringProtocols = ko.observableArray();
projectService.getMonitoringProtocols().done(function(protocols) {
if (!_.isArray(protocols)) {
protocols = [];
}
// If the protocol list doesn't contain 'Other', add it.
if (!_.find(protocols, function(protocol) { return protocol.value.toLowerCase() == 'other'; })) {
protocols.push({label:'Other', value:'Other'});
}
self.monitoringProtocols(protocols);
});
if (config.useServiceOutcomesModel) {
projectService.getMonitoringProtocols().done(function(protocols) {
if (!_.isArray(protocols)) {
protocols = [];
}
// If the protocol list doesn't contain 'Other', add it.
if (!_.find(protocols, function(protocol) { return protocol.value.toLowerCase() == 'other'; })) {
protocols.push({label:'Other', value:'Other'});
}
self.monitoringProtocols(protocols);
});
}

self.addBudget = function () {
self.meriPlan().budget.rows.push(new BudgetRowViewModel({}, periods));
Expand Down

0 comments on commit 2127a41

Please sign in to comment.