Skip to content

Commit

Permalink
Issue #CO-760 merge: Merge pull request #343 from shubhambansaltarent…
Browse files Browse the repository at this point in the history
…o/bug/CO-760

Issue #CO-760 Fw user cat issue
  • Loading branch information
vinukumar-vs authored May 14, 2024
2 parents e469e65 + 329808a commit 8fb4a99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/helpers/programHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ class ProgramServiceHelper {
* @param integer program_id Program id
* @param integer user_id User id
*/
async onAfterAddNomination(program_id, user_id) {
async onAfterAddNomination(program_id, user_id, frameworkCategories) {
const program = await this.getProgramDetails(program_id);
const value = {};
value['body'] = {
Expand All @@ -975,17 +975,20 @@ class ProgramServiceHelper {
registryService.searchRecord(value, (err, res) => {
if (!err && res) {
const user = _.first(res.data.result.User);
let User ={}
User.osid = user.osid;
if(!!frameworkCategories){
frameworkCategories.forEach((cat) =>{
User[cat] = _.union(user[cat], program.config[cat])
})
}

const updateRequestBody = {};
updateRequestBody['body'] = {
"id": "open-saber.registry.update",
"ver": "1.0",
"request": {
"User": {
"osid": user.osid,
"medium": _.union(user.medium, program.config.medium),
"gradeLevel": _.union(user.gradeLevel, program.config.gradeLevel),
"subject": _.union(user.subject, program.config.subject)
}
"User": User
}
};
registryService.updateRecord(updateRequestBody, (error, response) => {
Expand Down
2 changes: 1 addition & 1 deletion src/service/programService.js
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ function addNomination(req, response) {
}

model.nomination.create(insertObj).then(res => {
programServiceHelper.onAfterAddNomination(insertObj.program_id, insertObj.user_id);
programServiceHelper.onAfterAddNomination(insertObj.program_id, insertObj.user_id, data.request.frameworkCategories);
loggerService.exitLog({responseCode: rspObj.responseCode, 'program_id': insertObj.program_id}, logObject);
rspObj.responseCode = responseCode.SUCCESS;
rspObj.result = {
Expand Down

0 comments on commit 8fb4a99

Please sign in to comment.