lms-sync 1.0.6 → 1.0.8
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 +47 -5
- 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,8 @@ 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
|
|
1234
1236
|
|
|
1235
1237
|
|
|
1236
1238
|
let _inst = instructorApi.find(i => i.faculty_id === instrcutor)
|
|
@@ -1253,9 +1255,7 @@ const server = {
|
|
|
1253
1255
|
continue;
|
|
1254
1256
|
}
|
|
1255
1257
|
|
|
1256
|
-
|
|
1257
|
-
let rmarks = _students[j].remarks
|
|
1258
|
-
|
|
1258
|
+
|
|
1259
1259
|
let totalPoints = 100
|
|
1260
1260
|
let finalG = fGrade
|
|
1261
1261
|
let gradePoints = ((-4.0 / totalPoints) * parseFloat (finalG) + 5.0).toFixed(2)
|
|
@@ -1263,7 +1263,10 @@ const server = {
|
|
|
1263
1263
|
if (gradePoints){
|
|
1264
1264
|
graded = true
|
|
1265
1265
|
}
|
|
1266
|
-
|
|
1266
|
+
else if (!gradePoints){
|
|
1267
|
+
gradePoints = 0
|
|
1268
|
+
}
|
|
1269
|
+
let remarks = rmarks?.toUpperCase()??null
|
|
1267
1270
|
|
|
1268
1271
|
// return
|
|
1269
1272
|
let [record, created] = await EnrolledStudents.findOrCreate({
|
|
@@ -1276,6 +1279,7 @@ const server = {
|
|
|
1276
1279
|
academicYearId: _acadYear?._id,
|
|
1277
1280
|
semesterId: _semester?._id,
|
|
1278
1281
|
finalGrade: gradePoints,
|
|
1282
|
+
graded,
|
|
1279
1283
|
remarks,
|
|
1280
1284
|
createdById,
|
|
1281
1285
|
modifiedById,
|
|
@@ -1326,6 +1330,7 @@ const server = {
|
|
|
1326
1330
|
|
|
1327
1331
|
}
|
|
1328
1332
|
},
|
|
1333
|
+
|
|
1329
1334
|
|
|
1330
1335
|
async executeAll(){
|
|
1331
1336
|
await this.Campus()
|
|
@@ -1344,5 +1349,42 @@ const server = {
|
|
|
1344
1349
|
}
|
|
1345
1350
|
}
|
|
1346
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
|
|
1347
1386
|
|
|
1348
|
-
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.');
|