@neutron.co.id/pendidikan-operation 1.29.4 → 1.29.5
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.
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const core = require('@neon.id/core');
|
|
4
4
|
const operation = require('@neon.id/operation');
|
|
5
5
|
const utils = require('@neon.id/utils');
|
|
6
|
-
const setClassSessionDependencies_action = require('./setClassSessionDependencies/setClassSessionDependencies.action.cjs');
|
|
7
6
|
const useTelemetry = require('../../providers/useTelemetry.cjs');
|
|
8
7
|
|
|
9
8
|
const bulkUpdateSession = operation.Action.define({
|
|
@@ -20,6 +19,7 @@ const bulkUpdateSession = operation.Action.define({
|
|
|
20
19
|
}, async () => {
|
|
21
20
|
const dbs = stream.core.dbs;
|
|
22
21
|
const dbSession = dbs["neu-jadwal"].models["neu:jadwal:classSession"];
|
|
22
|
+
const dbAttendance = dbs["neu-jadwal"].models["neu:jadwal:classAttendance"];
|
|
23
23
|
const updateData = {};
|
|
24
24
|
if (input.data.teacherRepeaterIds)
|
|
25
25
|
updateData.teacherIds = input.data.teacherRepeaterIds;
|
|
@@ -38,19 +38,53 @@ const bulkUpdateSession = operation.Action.define({
|
|
|
38
38
|
updateData.status = input.data.status;
|
|
39
39
|
if (input.data.classSessionPurposeId)
|
|
40
40
|
updateData.classSessionPurposeId = input.data.classSessionPurposeId;
|
|
41
|
-
await
|
|
41
|
+
const attendances = await dbAttendance.find(
|
|
42
42
|
{
|
|
43
|
-
|
|
43
|
+
classSessionId: { $in: input.ids },
|
|
44
|
+
deletedAt: null
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
_id: 1,
|
|
48
|
+
classSessionId: 1,
|
|
49
|
+
teacherId: 1,
|
|
50
|
+
studentId: 1,
|
|
51
|
+
presenceType: 1
|
|
50
52
|
}
|
|
51
53
|
);
|
|
54
|
+
const attendanceMap = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const att of attendances) {
|
|
56
|
+
const key = att.classSessionId?.toString();
|
|
57
|
+
if (!key)
|
|
58
|
+
continue;
|
|
59
|
+
if (!attendanceMap.has(key))
|
|
60
|
+
attendanceMap.set(key, []);
|
|
61
|
+
attendanceMap.get(key).push(att);
|
|
62
|
+
}
|
|
52
63
|
await Promise.all(
|
|
53
|
-
input.ids.map((id) =>
|
|
64
|
+
input.ids.map((id) => {
|
|
65
|
+
const sessionAttendances = attendanceMap.get(id) || [];
|
|
66
|
+
const alreadyPresence = [
|
|
67
|
+
...new Set(
|
|
68
|
+
sessionAttendances.filter((c) => !!c.teacherId && c.presenceType === "teacher").map((c) => c.teacherId?.toString())
|
|
69
|
+
)
|
|
70
|
+
].map((id2) => new core.ObjectId(id2));
|
|
71
|
+
const studentAlreadyPresence = [
|
|
72
|
+
...new Set(
|
|
73
|
+
sessionAttendances.filter((c) => !!c.studentId && c.presenceType === "student").map((c) => c.studentId?.toString())
|
|
74
|
+
)
|
|
75
|
+
].map((id2) => new core.ObjectId(id2));
|
|
76
|
+
return dbSession.updateOne(
|
|
77
|
+
{ _id: id },
|
|
78
|
+
{
|
|
79
|
+
$set: {
|
|
80
|
+
...updateData,
|
|
81
|
+
virtualBranchIds: updateData.branchIds,
|
|
82
|
+
alreadyPresence,
|
|
83
|
+
studentAlreadyPresence
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
})
|
|
54
88
|
);
|
|
55
89
|
return core.Result.ok({
|
|
56
90
|
state: "bulkSessionUpdate",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Result } from '@neon.id/core';
|
|
1
|
+
import { ObjectId, Result } from '@neon.id/core';
|
|
2
2
|
import { Action } from '@neon.id/operation';
|
|
3
3
|
import { guard } from '@neon.id/utils';
|
|
4
|
-
import { setClassSessionDependencies } from './setClassSessionDependencies/setClassSessionDependencies.action.mjs';
|
|
5
4
|
import { useTelemetry } from '../../providers/useTelemetry.mjs';
|
|
6
5
|
|
|
7
6
|
const bulkUpdateSession = Action.define({
|
|
@@ -18,6 +17,7 @@ const bulkUpdateSession = Action.define({
|
|
|
18
17
|
}, async () => {
|
|
19
18
|
const dbs = stream.core.dbs;
|
|
20
19
|
const dbSession = dbs["neu-jadwal"].models["neu:jadwal:classSession"];
|
|
20
|
+
const dbAttendance = dbs["neu-jadwal"].models["neu:jadwal:classAttendance"];
|
|
21
21
|
const updateData = {};
|
|
22
22
|
if (input.data.teacherRepeaterIds)
|
|
23
23
|
updateData.teacherIds = input.data.teacherRepeaterIds;
|
|
@@ -36,19 +36,53 @@ const bulkUpdateSession = Action.define({
|
|
|
36
36
|
updateData.status = input.data.status;
|
|
37
37
|
if (input.data.classSessionPurposeId)
|
|
38
38
|
updateData.classSessionPurposeId = input.data.classSessionPurposeId;
|
|
39
|
-
await
|
|
39
|
+
const attendances = await dbAttendance.find(
|
|
40
40
|
{
|
|
41
|
-
|
|
41
|
+
classSessionId: { $in: input.ids },
|
|
42
|
+
deletedAt: null
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
_id: 1,
|
|
46
|
+
classSessionId: 1,
|
|
47
|
+
teacherId: 1,
|
|
48
|
+
studentId: 1,
|
|
49
|
+
presenceType: 1
|
|
48
50
|
}
|
|
49
51
|
);
|
|
52
|
+
const attendanceMap = /* @__PURE__ */ new Map();
|
|
53
|
+
for (const att of attendances) {
|
|
54
|
+
const key = att.classSessionId?.toString();
|
|
55
|
+
if (!key)
|
|
56
|
+
continue;
|
|
57
|
+
if (!attendanceMap.has(key))
|
|
58
|
+
attendanceMap.set(key, []);
|
|
59
|
+
attendanceMap.get(key).push(att);
|
|
60
|
+
}
|
|
50
61
|
await Promise.all(
|
|
51
|
-
input.ids.map((id) =>
|
|
62
|
+
input.ids.map((id) => {
|
|
63
|
+
const sessionAttendances = attendanceMap.get(id) || [];
|
|
64
|
+
const alreadyPresence = [
|
|
65
|
+
...new Set(
|
|
66
|
+
sessionAttendances.filter((c) => !!c.teacherId && c.presenceType === "teacher").map((c) => c.teacherId?.toString())
|
|
67
|
+
)
|
|
68
|
+
].map((id2) => new ObjectId(id2));
|
|
69
|
+
const studentAlreadyPresence = [
|
|
70
|
+
...new Set(
|
|
71
|
+
sessionAttendances.filter((c) => !!c.studentId && c.presenceType === "student").map((c) => c.studentId?.toString())
|
|
72
|
+
)
|
|
73
|
+
].map((id2) => new ObjectId(id2));
|
|
74
|
+
return dbSession.updateOne(
|
|
75
|
+
{ _id: id },
|
|
76
|
+
{
|
|
77
|
+
$set: {
|
|
78
|
+
...updateData,
|
|
79
|
+
virtualBranchIds: updateData.branchIds,
|
|
80
|
+
alreadyPresence,
|
|
81
|
+
studentAlreadyPresence
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
})
|
|
52
86
|
);
|
|
53
87
|
return Result.ok({
|
|
54
88
|
state: "bulkSessionUpdate",
|
package/build/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ const action_deleteManySession = require('./actions/jadwal/action.deleteManySess
|
|
|
27
27
|
const action_syncStudentAdmisi = require('./actions/akademik/action.syncStudentAdmisi.cjs');
|
|
28
28
|
const action_checkClassAttendance = require('./actions/jadwal/action.checkClassAttendance.cjs');
|
|
29
29
|
const syncClassSessions_action = require('./actions/jadwal/syncClassSessions/syncClassSessions.action.cjs');
|
|
30
|
+
const setClassSessionDependencies_action = require('./actions/jadwal/setClassSessionDependencies/setClassSessionDependencies.action.cjs');
|
|
30
31
|
const setAksesModulSiswaDiClassGroup_action = require('./actions/jadwal/setAksesModulSiswaDiClassGroup/setAksesModulSiswaDiClassGroup.action.cjs');
|
|
31
32
|
const getClassSessionConflicts_action = require('./actions/jadwal/getClassSessionConflicts/getClassSessionConflicts.action.cjs');
|
|
32
33
|
const setTravelWageSessions_action = require('./actions/jadwal/setTravelWageSessions/setTravelWageSessions.action.cjs');
|
|
@@ -60,7 +61,6 @@ const action_syncStudents = require('./actions/akademik/action.syncStudents.cjs'
|
|
|
60
61
|
const sendClassConsultationNotification_action = require('./actions/jadwal/sendClassConsultationNotification/sendClassConsultationNotification.action.cjs');
|
|
61
62
|
const sendScoreNotification_action = require('./actions/penilaian/sendScoreNotification/sendScoreNotification.action.cjs');
|
|
62
63
|
const replaceModuleAccessManyStudent_action = require('./actions/replaceModuleAccessManyStudent/replaceModuleAccessManyStudent.action.cjs');
|
|
63
|
-
const setClassSessionDependencies_action = require('./actions/jadwal/setClassSessionDependencies/setClassSessionDependencies.action.cjs');
|
|
64
64
|
const action_clearGrading = require('./actions/rasionalisasi/action.clearGrading.cjs');
|
|
65
65
|
const action_createGradingAndScores = require('./actions/rasionalisasi/action.createGradingAndScores.cjs');
|
|
66
66
|
const action_updateGradingAndScores = require('./actions/rasionalisasi/action.updateGradingAndScores.cjs');
|
|
@@ -191,6 +191,7 @@ exports.deleteManySession = action_deleteManySession.deleteManySession;
|
|
|
191
191
|
exports.syncStudentAdmisi = action_syncStudentAdmisi.syncStudentAdmisi;
|
|
192
192
|
exports.checkClassAttendance = action_checkClassAttendance.checkClassAttendance;
|
|
193
193
|
exports.syncClassSessions = syncClassSessions_action.syncClassSessions;
|
|
194
|
+
exports.setClassSessionDependencies = setClassSessionDependencies_action.setClassSessionDependencies;
|
|
194
195
|
exports.setAksesModulSiswaDiClassGroup = setAksesModulSiswaDiClassGroup_action.setAksesModulSiswaDiClassGroup;
|
|
195
196
|
exports.getClassSessionConflicts = getClassSessionConflicts_action.getClassSessionConflicts;
|
|
196
197
|
exports.setTravelWageSessions = setTravelWageSessions_action.setTravelWageSessions;
|
|
@@ -226,7 +227,6 @@ exports.syncStudents = action_syncStudents.syncStudents;
|
|
|
226
227
|
exports.sendClassConsultationNotification = sendClassConsultationNotification_action.sendClassConsultationNotification;
|
|
227
228
|
exports.sendScoreNotification = sendScoreNotification_action.sendScoreNotification;
|
|
228
229
|
exports.replaceModuleAccessManyStudent = replaceModuleAccessManyStudent_action.replaceModuleAccessManyStudent;
|
|
229
|
-
exports.setClassSessionDependencies = setClassSessionDependencies_action.setClassSessionDependencies;
|
|
230
230
|
exports.clearGrading = action_clearGrading.clearGrading;
|
|
231
231
|
exports.createGradingAndScores = action_createGradingAndScores.createGradingAndScores;
|
|
232
232
|
exports.updateGradingAndScores = action_updateGradingAndScores.updateGradingAndScores;
|
package/build/index.mjs
CHANGED
|
@@ -25,6 +25,7 @@ import { deleteManySession } from './actions/jadwal/action.deleteManySession.mjs
|
|
|
25
25
|
import { syncStudentAdmisi } from './actions/akademik/action.syncStudentAdmisi.mjs';
|
|
26
26
|
import { checkClassAttendance } from './actions/jadwal/action.checkClassAttendance.mjs';
|
|
27
27
|
import { syncClassSessions } from './actions/jadwal/syncClassSessions/syncClassSessions.action.mjs';
|
|
28
|
+
import { setClassSessionDependencies } from './actions/jadwal/setClassSessionDependencies/setClassSessionDependencies.action.mjs';
|
|
28
29
|
import { setAksesModulSiswaDiClassGroup } from './actions/jadwal/setAksesModulSiswaDiClassGroup/setAksesModulSiswaDiClassGroup.action.mjs';
|
|
29
30
|
import { getClassSessionConflicts } from './actions/jadwal/getClassSessionConflicts/getClassSessionConflicts.action.mjs';
|
|
30
31
|
import { setTravelWageSessions } from './actions/jadwal/setTravelWageSessions/setTravelWageSessions.action.mjs';
|
|
@@ -60,7 +61,6 @@ import { syncStudents } from './actions/akademik/action.syncStudents.mjs';
|
|
|
60
61
|
import { sendClassConsultationNotification } from './actions/jadwal/sendClassConsultationNotification/sendClassConsultationNotification.action.mjs';
|
|
61
62
|
import { sendScoreNotification } from './actions/penilaian/sendScoreNotification/sendScoreNotification.action.mjs';
|
|
62
63
|
import { replaceModuleAccessManyStudent } from './actions/replaceModuleAccessManyStudent/replaceModuleAccessManyStudent.action.mjs';
|
|
63
|
-
import { setClassSessionDependencies } from './actions/jadwal/setClassSessionDependencies/setClassSessionDependencies.action.mjs';
|
|
64
64
|
import { clearGrading } from './actions/rasionalisasi/action.clearGrading.mjs';
|
|
65
65
|
import { createGradingAndScores } from './actions/rasionalisasi/action.createGradingAndScores.mjs';
|
|
66
66
|
import { updateGradingAndScores } from './actions/rasionalisasi/action.updateGradingAndScores.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neutron.co.id/pendidikan-operation",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.5",
|
|
4
4
|
"description": "Operation package of Neutron Pendidikan.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"contributors": [
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"build":
|
|
89
|
+
"build": 161
|
|
90
90
|
}
|