lms-sync 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apiConnections/apiConnects.js +1 -0
- package/apiConnections/mapping.js +57 -2
- package/app.js +2 -1
- package/package.json +1 -1
@@ -206,6 +206,7 @@ const Apis = {
|
|
206
206
|
try {
|
207
207
|
const { login, apis } = await this.Login();
|
208
208
|
const {currentSchoolYear} = await this.AcademicYear()
|
209
|
+
// console.log('currentSchoolYear :>> ', currentSchoolYear);
|
209
210
|
const student = await apis.instance.post('/students/enrolled',
|
210
211
|
{
|
211
212
|
"school_year": `${currentSchoolYear}`,
|
@@ -1231,6 +1231,9 @@ const server = {
|
|
1231
1231
|
|
1232
1232
|
let instrcutor = _students[j].faculty_id
|
1233
1233
|
let sections = _students[j].section_name
|
1234
|
+
let fGrade = _students[j].final_grade
|
1235
|
+
let rmarks = _students[j].remarks
|
1236
|
+
|
1234
1237
|
|
1235
1238
|
let _inst = instructorApi.find(i => i.faculty_id === instrcutor)
|
1236
1239
|
|
@@ -1240,7 +1243,6 @@ const server = {
|
|
1240
1243
|
let _section = sectionSeq.find(sec => sec.name === sections)
|
1241
1244
|
|
1242
1245
|
|
1243
|
-
|
1244
1246
|
if (!_inst) {
|
1245
1247
|
continue;
|
1246
1248
|
}
|
@@ -1254,6 +1256,18 @@ const server = {
|
|
1254
1256
|
}
|
1255
1257
|
|
1256
1258
|
|
1259
|
+
let totalPoints = 100
|
1260
|
+
let finalG = fGrade
|
1261
|
+
let gradePoints = ((-4.0 / totalPoints) * parseFloat (finalG) + 5.0).toFixed(2)
|
1262
|
+
let graded = false
|
1263
|
+
if (gradePoints){
|
1264
|
+
graded = true
|
1265
|
+
}
|
1266
|
+
else if (!gradePoints){
|
1267
|
+
gradePoints = 0
|
1268
|
+
}
|
1269
|
+
let remarks = rmarks?.toUpperCase()??null
|
1270
|
+
|
1257
1271
|
// return
|
1258
1272
|
let [record, created] = await EnrolledStudents.findOrCreate({
|
1259
1273
|
where:{
|
@@ -1264,6 +1278,9 @@ const server = {
|
|
1264
1278
|
campusId: campus?._id,
|
1265
1279
|
academicYearId: _acadYear?._id,
|
1266
1280
|
semesterId: _semester?._id,
|
1281
|
+
finalGrade: gradePoints,
|
1282
|
+
graded,
|
1283
|
+
remarks,
|
1267
1284
|
createdById,
|
1268
1285
|
modifiedById,
|
1269
1286
|
},
|
@@ -1313,6 +1330,7 @@ const server = {
|
|
1313
1330
|
|
1314
1331
|
}
|
1315
1332
|
},
|
1333
|
+
|
1316
1334
|
|
1317
1335
|
async executeAll(){
|
1318
1336
|
await this.Campus()
|
@@ -1331,5 +1349,42 @@ const server = {
|
|
1331
1349
|
}
|
1332
1350
|
}
|
1333
1351
|
|
1352
|
+
async function runServerFunctions() {
|
1353
|
+
const results = {};
|
1354
|
+
try {
|
1355
|
+
for (const funcKey in server) {
|
1356
|
+
if(typeof server[funcKey] === 'function'){
|
1357
|
+
const funcName = server[funcKey].name;
|
1358
|
+
results[funcName] = await server[funcKey]();
|
1359
|
+
}
|
1360
|
+
}
|
1361
|
+
} catch (error) {
|
1362
|
+
logger.error(`Error occurred: ${error.stack || error}`);
|
1363
|
+
}
|
1364
|
+
console.log("");
|
1365
|
+
console.log("########################################################");
|
1366
|
+
console.log(" TOTAL SUMMARY");
|
1367
|
+
console.log("########################################################");
|
1368
|
+
|
1369
|
+
Object.entries(results).map(async ([key, value]) =>{
|
1370
|
+
console.log("");
|
1371
|
+
console.log(`${key.toUpperCase()}:`);
|
1372
|
+
logger.info(`total Success ${key} Record: ${value?.success??""}/${value?.itemLength??""}`);
|
1373
|
+
logger.info(`total Error ${key} Record: ${value?.error??""}/${value?.itemLength??""}`);
|
1374
|
+
console.log("");
|
1375
|
+
});
|
1376
|
+
|
1377
|
+
console.log("########################################################");
|
1378
|
+
console.log(" END OF MIGRATION");
|
1379
|
+
console.log("########################################################");
|
1380
|
+
}
|
1381
|
+
|
1382
|
+
|
1383
|
+
|
1384
|
+
|
1385
|
+
// module.exports = server
|
1334
1386
|
|
1335
|
-
module.exports =
|
1387
|
+
module.exports = {
|
1388
|
+
Server: runServerFunctions,
|
1389
|
+
Enrolled: server.EnrolledStudent
|
1390
|
+
}
|
package/app.js
CHANGED
@@ -20,7 +20,8 @@ async function start(){
|
|
20
20
|
}
|
21
21
|
if(apis && startSequel){
|
22
22
|
console.log('Both connections successful. Starting migrations...');
|
23
|
-
await mappings.
|
23
|
+
// await mappings.Server()
|
24
|
+
await mappings.Enrolled()
|
24
25
|
}
|
25
26
|
else {
|
26
27
|
console.error('Failed to establish database and api connections. Migrations not started.');
|