Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arcshiftsolutions committed May 14, 2024
1 parent 395a893 commit e886d7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions backend/src/components/edx/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {FILTER_OPERATION, VALUE_TYPE, CACHE_KEYS} = require('../../util/constants
const {LocalDateTime, DateTimeFormatter} = require('@js-joda/core');
const cacheService = require('../cache-service');
const log = require('../logger');
const {setIssueTranscriptAndCertificatesFlags} = require('../institute/institute');

async function claimAllExchanges(req, res) {
try {
Expand Down Expand Up @@ -995,6 +996,7 @@ async function createSchool(req, res) {
});
}

await setIssueTranscriptAndCertificatesFlags(school);
const userInfo = utils.getUser(req);
const payload = {
school: {
Expand Down Expand Up @@ -1064,13 +1066,12 @@ async function findAllSchoolInvitations(req, res) {

async function uploadOnboardingFile(req, res){
try {
console.log("Upload file: ", JSON.stringify(req.body))
const user = utils.getUser(req);

const document = {
fileContents: req.body.fileContents,
createUser: user.idir_username
}
};

const result = await postData(config.get('server:edx:uploadOnboardingFile'), document, null, null);
return res.status(HttpStatus.OK).json(result);
Expand Down
9 changes: 6 additions & 3 deletions backend/src/components/institute/institute.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ async function addSchool(req, res) {
payload.grades = req.body.grades;
}

await setIssueTranscriptAndCertificatesFlags(payload);

const data = await utils.postData(config.get('server:institute:instituteSchoolURL'), payload, null, utils.getUser(req).idir_username);
return res.status(HttpStatus.OK).json(data);
} catch (e) {
Expand Down Expand Up @@ -1358,9 +1360,9 @@ async function setIssueTranscriptAndCertificatesFlags(school){
let canIssueTranscripts = false;
let canIssueCertificates = false;

let grade10toSUFundingCodes = school.schoolFundingGroups.filter(group => gradesArray.includes(group.schoolGradeCode));
let schoolHas10toSUGrades = school.grades.some(grade => gradesArray.includes(grade.schoolGradeCode));
let hasGroup1or2or4 = grade10toSUFundingCodes.some(group => groupsArray.includes(group.schoolFundingGroupCode));
let grade10toSUFundingCodes = school.schoolFundingGroups?.filter(group => gradesArray.includes(group.schoolGradeCode));
let schoolHas10toSUGrades = school.grades?.some(grade => gradesArray.includes(grade.schoolGradeCode));
let hasGroup1or2or4 = grade10toSUFundingCodes?.some(group => groupsArray.includes(group.schoolFundingGroupCode));

switch(school.schoolCategoryCode) {
case 'PUBLIC':
Expand Down Expand Up @@ -1467,6 +1469,7 @@ module.exports = {
updateFundingDataForSchool,
getFundingGroupDataForSchool,
moveSchool,
setIssueTranscriptAndCertificatesFlags,
getStudentRegistrationContacts,
getStudentRegistrationContactByMincode,
getSchoolByMincode,
Expand Down

0 comments on commit e886d7d

Please sign in to comment.