Skip to content

Commit

Permalink
fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen committed Mar 21, 2024
1 parent 4b049d6 commit e13723c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
51 changes: 24 additions & 27 deletions portal/static/js/src/empro.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ emproObj.prototype.init = function () {

this.initTriggerDomains(
{
maxTryAttempts: isDebugging && !autoShowModal ? 1 : 5,
clearCache: autoShowModal,
},
(result) => {
Expand Down Expand Up @@ -526,37 +527,33 @@ emproObj.prototype.initTriggerDomains = function (params, callbackFunc) {
}
//var self = this;
const isDebugging = getUrlParameter("debug");
tnthAjax.getSubStudyTriggers(
this.userId,
{ maxTryAttempts: isDebugging ? 1 : 5, ...(params ? params : {}) },
(data) => {
if (isDebugging) {
data = TestTriggersJson;
}
console.log("Trigger data: ", data);
if (!data || data.error || !data.triggers || !data.triggers.domain) {
callback({ error: true, reason: "no trigger data" });
return false;
}
tnthAjax.getSubStudyTriggers(this.userId, params, (data) => {
if (isDebugging) {
data = TestTriggersJson;
}
console.log("Trigger data: ", data);
if (!data || data.error || !data.triggers || !data.triggers.domain) {
callback({ error: true, reason: "no trigger data" });
return false;
}

this.processTriggerData(data);
this.processTriggerData(data);

/*
* display user domain topic(s)
*/
this.populateDomainDisplay();
/*
* show/hide sections based on triggers
*/
this.initTriggerItemsVis();
/*
* display user domain topic(s)
*/
this.populateDomainDisplay();
/*
* show/hide sections based on triggers
*/
this.initTriggerItemsVis();

callback(data);
callback(data);

//console.log("self.domains? ", self.domains);
//console.log("has hard triggers ", self.hasHardTrigger);
//console.log("has soft triggers ", self.hasSoftTrigger);
}
);
//console.log("self.domains? ", self.domains);
//console.log("has hard triggers ", self.hasHardTrigger);
//console.log("has soft triggers ", self.hasSoftTrigger);
});
};
let EmproObj = new emproObj();
$(document).ready(function () {
Expand Down
1 change: 1 addition & 0 deletions portal/static/js/src/modules/TnthAjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export default { /*global $ */
}

const dataState = String(data.state).toLowerCase();
params = params || {};

if (params.retryAttempt < params.maxTryAttempts &&
dataState !== EMPRO_TRIGGER_PRESTATE &&
Expand Down

0 comments on commit e13723c

Please sign in to comment.