@neutron.co.id/pendidikan-operation 1.26.6 → 1.26.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.
@@ -34,7 +34,7 @@ const presenceSessionStudent = operation.Action.define({
34
34
  data: {
35
35
  classSessionId: input.sessionId,
36
36
  studentId: input.studentId,
37
- teacherId: input.teacherId,
37
+ // teacherId: input.teacherId,
38
38
  classSessionBranchIds: session.branchIds,
39
39
  presenceType: "student",
40
40
  isAbsent: false,
@@ -32,7 +32,7 @@ const presenceSessionStudent = Action.define({
32
32
  data: {
33
33
  classSessionId: input.sessionId,
34
34
  studentId: input.studentId,
35
- teacherId: input.teacherId,
35
+ // teacherId: input.teacherId,
36
36
  classSessionBranchIds: session.branchIds,
37
37
  presenceType: "student",
38
38
  isAbsent: false,
@@ -54,7 +54,7 @@ const syncStudentReport = operation.Action.define({
54
54
  $gte: input.startedAt,
55
55
  $lte: input.endedAt
56
56
  },
57
- isAbsent: false,
57
+ // isAbsent: { $exists: false, $ne: true },
58
58
  deletedAt: { $exists: false }
59
59
  }).sort({ createdAt: -1 });
60
60
  const attendanceCount = resultAttendance.length;
@@ -87,7 +87,6 @@ const syncStudentReport = operation.Action.define({
87
87
  }
88
88
  const resultCheckIn = await dbCheckIn.find({
89
89
  studentId: input.studentId,
90
- branchIds: { $in: input.branchIds },
91
90
  checkInAt: {
92
91
  $gte: input.startedAt,
93
92
  $lte: input.endedAt
@@ -95,7 +94,6 @@ const syncStudentReport = operation.Action.define({
95
94
  deletedAt: { $exists: false }
96
95
  }).sort({ createdAt: -1 });
97
96
  const checkInCount = resultCheckIn.length;
98
- console.log("result", resultCheckIn[0]);
99
97
  if (resultCheckIn.length > 0) {
100
98
  await dbStudent.updateOne(
101
99
  { _id: input.studentId },
@@ -184,6 +182,26 @@ const syncStudentReport = operation.Action.define({
184
182
  })
185
183
  }, stream);
186
184
  const sessionCount = resultSession.payload?.data?.total || 0;
185
+ const resultSchedule = await stream.actions.data.getMany.execute({
186
+ model: "neu:jadwal:classSession",
187
+ query: query.Query.define({
188
+ filter: {
189
+ startedAt: { $gte: input.startedAt, $lte: input.endedAt },
190
+ branchIds: { $in: input.branchIds },
191
+ studentIds: { $in: [input.studentId] }
192
+ },
193
+ fields: {
194
+ id: 1,
195
+ createdAt: 1,
196
+ startedAt: 1
197
+ }
198
+ })
199
+ }, stream);
200
+ const startedDates = resultSchedule?.payload?.data?.map((item) => {
201
+ return utils.DateUtil.format(new Date(item.startedAt), { format: "yyyy-MM-dd" });
202
+ });
203
+ const uniqueDays = new Set(startedDates);
204
+ const scheduleCount = uniqueDays.size;
187
205
  const sessionOffline = await stream.actions.data.count.execute({
188
206
  model: "neu:jadwal:classSession",
189
207
  query: query.Query.define({
@@ -228,7 +246,8 @@ const syncStudentReport = operation.Action.define({
228
246
  totalSession: sessionCount,
229
247
  sessionOffline: totalOffline,
230
248
  sessionOnline: totalOnline,
231
- sessionHybrid: totalHybrid
249
+ sessionHybrid: totalHybrid,
250
+ daySession: scheduleCount
232
251
  }
233
252
  }
234
253
  );
@@ -240,7 +259,40 @@ const syncStudentReport = operation.Action.define({
240
259
  totalSession: sessionCount,
241
260
  sessionOffline: totalOffline,
242
261
  sessionOnline: totalOnline,
243
- sessionHybrid: totalHybrid
262
+ sessionHybrid: totalHybrid,
263
+ daySession: scheduleCount
264
+ }
265
+ }
266
+ );
267
+ }
268
+ const activityResult = await stream.actions.data.count.execute({
269
+ model: "neu:jadwal:classActivity",
270
+ query: query.Query.define({
271
+ filter: {
272
+ studentId: input.studentId,
273
+ createdAt: {
274
+ $gte: input.startedAt,
275
+ $lte: input.endedAt
276
+ }
277
+ }
278
+ })
279
+ }, stream);
280
+ const totalActivities = activityResult.payload?.data?.total || 0;
281
+ if (sessionCount > 0) {
282
+ await dbStudent.updateOne(
283
+ { _id: input.studentId },
284
+ {
285
+ $set: {
286
+ totalActivity: totalActivities
287
+ }
288
+ }
289
+ );
290
+ } else {
291
+ await dbStudent.updateOne(
292
+ { _id: input.studentId },
293
+ {
294
+ $set: {
295
+ totalActivity: totalActivities
244
296
  }
245
297
  }
246
298
  );
@@ -1,6 +1,6 @@
1
1
  import { Result } from '@neon.id/core';
2
2
  import { Action } from '@neon.id/operation';
3
- import { guard } from '@neon.id/utils';
3
+ import { guard, DateUtil } from '@neon.id/utils';
4
4
  import { Query } from '@neon.id/query';
5
5
 
6
6
  const syncStudentReport = Action.define({
@@ -52,7 +52,7 @@ const syncStudentReport = Action.define({
52
52
  $gte: input.startedAt,
53
53
  $lte: input.endedAt
54
54
  },
55
- isAbsent: false,
55
+ // isAbsent: { $exists: false, $ne: true },
56
56
  deletedAt: { $exists: false }
57
57
  }).sort({ createdAt: -1 });
58
58
  const attendanceCount = resultAttendance.length;
@@ -85,7 +85,6 @@ const syncStudentReport = Action.define({
85
85
  }
86
86
  const resultCheckIn = await dbCheckIn.find({
87
87
  studentId: input.studentId,
88
- branchIds: { $in: input.branchIds },
89
88
  checkInAt: {
90
89
  $gte: input.startedAt,
91
90
  $lte: input.endedAt
@@ -93,7 +92,6 @@ const syncStudentReport = Action.define({
93
92
  deletedAt: { $exists: false }
94
93
  }).sort({ createdAt: -1 });
95
94
  const checkInCount = resultCheckIn.length;
96
- console.log("result", resultCheckIn[0]);
97
95
  if (resultCheckIn.length > 0) {
98
96
  await dbStudent.updateOne(
99
97
  { _id: input.studentId },
@@ -182,6 +180,26 @@ const syncStudentReport = Action.define({
182
180
  })
183
181
  }, stream);
184
182
  const sessionCount = resultSession.payload?.data?.total || 0;
183
+ const resultSchedule = await stream.actions.data.getMany.execute({
184
+ model: "neu:jadwal:classSession",
185
+ query: Query.define({
186
+ filter: {
187
+ startedAt: { $gte: input.startedAt, $lte: input.endedAt },
188
+ branchIds: { $in: input.branchIds },
189
+ studentIds: { $in: [input.studentId] }
190
+ },
191
+ fields: {
192
+ id: 1,
193
+ createdAt: 1,
194
+ startedAt: 1
195
+ }
196
+ })
197
+ }, stream);
198
+ const startedDates = resultSchedule?.payload?.data?.map((item) => {
199
+ return DateUtil.format(new Date(item.startedAt), { format: "yyyy-MM-dd" });
200
+ });
201
+ const uniqueDays = new Set(startedDates);
202
+ const scheduleCount = uniqueDays.size;
185
203
  const sessionOffline = await stream.actions.data.count.execute({
186
204
  model: "neu:jadwal:classSession",
187
205
  query: Query.define({
@@ -226,7 +244,8 @@ const syncStudentReport = Action.define({
226
244
  totalSession: sessionCount,
227
245
  sessionOffline: totalOffline,
228
246
  sessionOnline: totalOnline,
229
- sessionHybrid: totalHybrid
247
+ sessionHybrid: totalHybrid,
248
+ daySession: scheduleCount
230
249
  }
231
250
  }
232
251
  );
@@ -238,7 +257,40 @@ const syncStudentReport = Action.define({
238
257
  totalSession: sessionCount,
239
258
  sessionOffline: totalOffline,
240
259
  sessionOnline: totalOnline,
241
- sessionHybrid: totalHybrid
260
+ sessionHybrid: totalHybrid,
261
+ daySession: scheduleCount
262
+ }
263
+ }
264
+ );
265
+ }
266
+ const activityResult = await stream.actions.data.count.execute({
267
+ model: "neu:jadwal:classActivity",
268
+ query: Query.define({
269
+ filter: {
270
+ studentId: input.studentId,
271
+ createdAt: {
272
+ $gte: input.startedAt,
273
+ $lte: input.endedAt
274
+ }
275
+ }
276
+ })
277
+ }, stream);
278
+ const totalActivities = activityResult.payload?.data?.total || 0;
279
+ if (sessionCount > 0) {
280
+ await dbStudent.updateOne(
281
+ { _id: input.studentId },
282
+ {
283
+ $set: {
284
+ totalActivity: totalActivities
285
+ }
286
+ }
287
+ );
288
+ } else {
289
+ await dbStudent.updateOne(
290
+ { _id: input.studentId },
291
+ {
292
+ $set: {
293
+ totalActivity: totalActivities
242
294
  }
243
295
  }
244
296
  );
@@ -1,2 +1,3 @@
1
1
  export * from './getGradingCount';
2
2
  export * from './refreshGrading';
3
+ export * from './refreshManyGrading';
@@ -0,0 +1,2 @@
1
+ export * from './refreshManyGrading.action';
2
+ export * from './refreshManyGrading.schema';
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ const core = require('@neon.id/core');
4
+ const operation = require('@neon.id/operation');
5
+ const utils = require('@neon.id/utils');
6
+ const refreshManyGrading_schema = require('./refreshManyGrading.schema.cjs');
7
+ const usePenilaian = require('../../../providers/penilaian/usePenilaian.cjs');
8
+
9
+ const refreshManyGrading = operation.Action.define({
10
+ key: "refreshManyGrading",
11
+ name: "Refresh Many Grading",
12
+ type: "command",
13
+ category: "domain",
14
+ execute: async (input, stream) => {
15
+ const { getActorId } = operation.useStream(stream);
16
+ const { validate } = operation.useValidation(stream, refreshManyGrading_schema.RefreshManyGradingSchema);
17
+ try {
18
+ const actorId = getActorId({ throw: true });
19
+ const data = validate(input);
20
+ const { prepareManyGradingScore } = usePenilaian.usePenilaian(stream);
21
+ actorId;
22
+ data;
23
+ utils.guard(stream, "streamRequired");
24
+ utils.guard(data.gradingTypeId, "gradingIdRequired");
25
+ await prepareManyGradingScore(stream, { gradingTypeId: data.gradingTypeId });
26
+ return core.Result.ok({
27
+ state: "refreshManyGrading",
28
+ message: "Refresh Grading has been sucessfully executedt.",
29
+ data: {}
30
+ });
31
+ } catch (error) {
32
+ if (error?.isFailure)
33
+ throw error;
34
+ console.error(error);
35
+ return core.Result.fail({
36
+ state: `refreshManyGradingFailed`,
37
+ message: `Failed to set refreshManyGrading.`,
38
+ error: error?.toString()
39
+ });
40
+ }
41
+ }
42
+ });
43
+
44
+ exports.refreshManyGrading = refreshManyGrading;
@@ -0,0 +1,12 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import { RefreshManyGradingSchema } from './refreshManyGrading.schema';
4
+ export type RefreshManyGradingInput = z.parse<typeof RefreshManyGradingSchema>;
5
+ export interface RefreshManyGradingOutput {
6
+ }
7
+ export interface RefreshManyGradingMeta {
8
+ }
9
+ export declare const refreshManyGrading: Action<"refreshManyGrading", {
10
+ gradingTypeId?: string | undefined;
11
+ }, RefreshManyGradingOutput, RefreshManyGradingMeta>;
12
+ export type RefreshManyGradingAction = typeof refreshManyGrading;
@@ -0,0 +1,42 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action, useStream, useValidation } from '@neon.id/operation';
3
+ import { guard } from '@neon.id/utils';
4
+ import { RefreshManyGradingSchema } from './refreshManyGrading.schema.mjs';
5
+ import { usePenilaian } from '../../../providers/penilaian/usePenilaian.mjs';
6
+
7
+ const refreshManyGrading = Action.define({
8
+ key: "refreshManyGrading",
9
+ name: "Refresh Many Grading",
10
+ type: "command",
11
+ category: "domain",
12
+ execute: async (input, stream) => {
13
+ const { getActorId } = useStream(stream);
14
+ const { validate } = useValidation(stream, RefreshManyGradingSchema);
15
+ try {
16
+ const actorId = getActorId({ throw: true });
17
+ const data = validate(input);
18
+ const { prepareManyGradingScore } = usePenilaian(stream);
19
+ actorId;
20
+ data;
21
+ guard(stream, "streamRequired");
22
+ guard(data.gradingTypeId, "gradingIdRequired");
23
+ await prepareManyGradingScore(stream, { gradingTypeId: data.gradingTypeId });
24
+ return Result.ok({
25
+ state: "refreshManyGrading",
26
+ message: "Refresh Grading has been sucessfully executedt.",
27
+ data: {}
28
+ });
29
+ } catch (error) {
30
+ if (error?.isFailure)
31
+ throw error;
32
+ console.error(error);
33
+ return Result.fail({
34
+ state: `refreshManyGradingFailed`,
35
+ message: `Failed to set refreshManyGrading.`,
36
+ error: error?.toString()
37
+ });
38
+ }
39
+ }
40
+ });
41
+
42
+ export { refreshManyGrading };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const z = require('@neon.id/z');
4
+
5
+ const RefreshManyGradingSchema = z.z.object({
6
+ gradingTypeId: z.z.string().optional().explain({ label: "Grading ID" })
7
+ });
8
+
9
+ exports.RefreshManyGradingSchema = RefreshManyGradingSchema;
@@ -0,0 +1,8 @@
1
+ import { z } from '@neon.id/z';
2
+ export declare const RefreshManyGradingSchema: z.ZodObject<{
3
+ gradingTypeId: z.ZodOptional<z.ZodString>;
4
+ }, "strip", z.ZodTypeAny, {
5
+ gradingTypeId?: string | undefined;
6
+ }, {
7
+ gradingTypeId?: string | undefined;
8
+ }>;
@@ -0,0 +1,7 @@
1
+ import { z } from '@neon.id/z';
2
+
3
+ const RefreshManyGradingSchema = z.object({
4
+ gradingTypeId: z.string().optional().explain({ label: "Grading ID" })
5
+ });
6
+
7
+ export { RefreshManyGradingSchema };
@@ -14,10 +14,8 @@ const addManyGradingComponent = operation.Action.define({
14
14
  utils.guard(input, "inputRequired");
15
15
  const dbs = stream.core.dbs;
16
16
  const dbScore = dbs["neu-penilaian"].models["neu:penilaian:score"];
17
- console.log(`ini gradingId...${input.gradingId}`);
18
17
  const dbGradingComponent = dbs["neu-penilaian"].models["neu:penilaian:gradingComponent"];
19
18
  const gradingTypeId = input.gradingTypeId;
20
- console.log(`ini gradingTypeId...${gradingTypeId}`);
21
19
  const findOneGrading = await dbGradingComponent.find({
22
20
  gradingTypeId: {
23
21
  $ne: "63ce5979e1166b8bb4bbc220",
@@ -12,10 +12,8 @@ const addManyGradingComponent = Action.define({
12
12
  guard(input, "inputRequired");
13
13
  const dbs = stream.core.dbs;
14
14
  const dbScore = dbs["neu-penilaian"].models["neu:penilaian:score"];
15
- console.log(`ini gradingId...${input.gradingId}`);
16
15
  const dbGradingComponent = dbs["neu-penilaian"].models["neu:penilaian:gradingComponent"];
17
16
  const gradingTypeId = input.gradingTypeId;
18
- console.log(`ini gradingTypeId...${gradingTypeId}`);
19
17
  const findOneGrading = await dbGradingComponent.find({
20
18
  gradingTypeId: {
21
19
  $ne: "63ce5979e1166b8bb4bbc220",
package/build/index.cjs CHANGED
@@ -30,6 +30,7 @@ const setTravelWageSessions_action = require('./actions/jadwal/setTravelWageSess
30
30
  const action_customSaveOneClassSession = require('./actions/jadwal/action.customSaveOneClassSession.cjs');
31
31
  const action_getGradingCount = require('./actions/penilaian/getGradingCount/action.getGradingCount.cjs');
32
32
  const refreshGrading_action = require('./actions/penilaian/refreshGrading/refreshGrading.action.cjs');
33
+ const refreshManyGrading_action = require('./actions/penilaian/refreshManyGrading/refreshManyGrading.action.cjs');
33
34
  const action_addManyGradingComponent = require('./actions/rasionalisasi/action.addManyGradingComponent.cjs');
34
35
  const action_calculateGrading = require('./actions/rasionalisasi/action.calculateGrading.cjs');
35
36
  const action_calculateManyComparator = require('./actions/rasionalisasi/action.calculateManyComparator.cjs');
@@ -57,6 +58,7 @@ const setTravelWageSessions_schema = require('./actions/jadwal/setTravelWageSess
57
58
  const importData_schema = require('./actions/importData/importData.schema.cjs');
58
59
  const prepareMediaScanterGradingInsert_schema = require('./actions/mediaScanter/prepareMediaScanterGradingInsert/prepareMediaScanterGradingInsert.schema.cjs');
59
60
  const refreshGrading_schema = require('./actions/penilaian/refreshGrading/refreshGrading.schema.cjs');
61
+ const refreshManyGrading_schema = require('./actions/penilaian/refreshManyGrading/refreshManyGrading.schema.cjs');
60
62
  const prepareExperience_schema = require('./actions/prepareExperience/prepareExperience.schema.cjs');
61
63
  const replaceModuleAccess_schema = require('./actions/replaceModuleAccess/replaceModuleAccess.schema.cjs');
62
64
  const refreshModuleAccess_schema = require('./actions/refreshModuleAccess/refreshModuleAccess.schema.cjs');
@@ -97,6 +99,7 @@ const actions = {
97
99
  // Penilaian
98
100
  getGradingCount: action_getGradingCount.getGradingCount,
99
101
  refreshGrading: refreshGrading_action.refreshGrading,
102
+ refreshManyGrading: refreshManyGrading_action.refreshManyGrading,
100
103
  // Rasionalisasi
101
104
  addManyGradingComponent: action_addManyGradingComponent.addManyGradingComponent,
102
105
  calculateGrading: action_calculateGrading.calculateGrading,
@@ -153,6 +156,7 @@ exports.setTravelWageSessions = setTravelWageSessions_action.setTravelWageSessio
153
156
  exports.customSaveOneClassSession = action_customSaveOneClassSession.customSaveOneClassSession;
154
157
  exports.getGradingCount = action_getGradingCount.getGradingCount;
155
158
  exports.refreshGrading = refreshGrading_action.refreshGrading;
159
+ exports.refreshManyGrading = refreshManyGrading_action.refreshManyGrading;
156
160
  exports.addManyGradingComponent = action_addManyGradingComponent.addManyGradingComponent;
157
161
  exports.calculateGrading = action_calculateGrading.calculateGrading;
158
162
  exports._calculateComparison = action_calculateManyComparator._calculateComparison;
@@ -182,6 +186,7 @@ exports.SetTravelWageSessionsSchema = setTravelWageSessions_schema.SetTravelWage
182
186
  exports.ImportDataSchema = importData_schema.ImportDataSchema;
183
187
  exports.PrepareMediaScanterGradingInsertSchema = prepareMediaScanterGradingInsert_schema.PrepareMediaScanterGradingInsertSchema;
184
188
  exports.RefreshGradingSchema = refreshGrading_schema.RefreshGradingSchema;
189
+ exports.RefreshManyGradingSchema = refreshManyGrading_schema.RefreshManyGradingSchema;
185
190
  exports.PrepareExperienceSchema = prepareExperience_schema.PrepareExperienceSchema;
186
191
  exports.ReplaceModuleAccessSchema = replaceModuleAccess_schema.ReplaceModuleAccessSchema;
187
192
  exports.RefreshModuleAccessSchema = refreshModuleAccess_schema.RefreshModuleAccessSchema;
package/build/index.d.ts CHANGED
@@ -59,6 +59,9 @@ export declare const actions: {
59
59
  refreshGrading: import("@neon.id/operation").Action<"refreshGrading", {
60
60
  gradingId?: string | undefined;
61
61
  }, import("./actions").RefreshGradingOutput, import("./actions").RefreshGradingMeta>;
62
+ refreshManyGrading: import("@neon.id/operation").Action<"refreshManyGrading", {
63
+ gradingTypeId?: string | undefined;
64
+ }, import("./actions").RefreshManyGradingOutput, import("./actions").RefreshManyGradingMeta>;
62
65
  addManyGradingComponent: import("@neon.id/operation").Action<"addManyGradingComponent", import("./actions").AddManyGradingComponentInput, import("./actions").AddManyGradingComponentOutput, import("./actions").AddManyGradingComponentMeta>;
63
66
  calculateGrading: import("@neon.id/operation").Action<"calculateGrading", import("./actions").CalculateGradingInput, import("./actions").CalculateGradingOutput, import("./actions").CalculateGradingMeta>;
64
67
  calculateManyComparator: import("@neon.id/operation").Action<"calculateManyComparator", import("./actions").CalculateManyComparatorInput, import("./actions").CalculateManyComparatorOutput, import("./actions").CalculateManyComparatorMeta>;
package/build/index.mjs CHANGED
@@ -28,6 +28,7 @@ import { setTravelWageSessions } from './actions/jadwal/setTravelWageSessions/se
28
28
  import { customSaveOneClassSession } from './actions/jadwal/action.customSaveOneClassSession.mjs';
29
29
  import { getGradingCount } from './actions/penilaian/getGradingCount/action.getGradingCount.mjs';
30
30
  import { refreshGrading } from './actions/penilaian/refreshGrading/refreshGrading.action.mjs';
31
+ import { refreshManyGrading } from './actions/penilaian/refreshManyGrading/refreshManyGrading.action.mjs';
31
32
  import { addManyGradingComponent } from './actions/rasionalisasi/action.addManyGradingComponent.mjs';
32
33
  import { calculateGrading } from './actions/rasionalisasi/action.calculateGrading.mjs';
33
34
  import { calculateManyComparator } from './actions/rasionalisasi/action.calculateManyComparator.mjs';
@@ -57,6 +58,7 @@ export { SetTravelWageSessionsSchema } from './actions/jadwal/setTravelWageSessi
57
58
  export { ImportDataSchema } from './actions/importData/importData.schema.mjs';
58
59
  export { PrepareMediaScanterGradingInsertSchema } from './actions/mediaScanter/prepareMediaScanterGradingInsert/prepareMediaScanterGradingInsert.schema.mjs';
59
60
  export { RefreshGradingSchema } from './actions/penilaian/refreshGrading/refreshGrading.schema.mjs';
61
+ export { RefreshManyGradingSchema } from './actions/penilaian/refreshManyGrading/refreshManyGrading.schema.mjs';
60
62
  export { PrepareExperienceSchema } from './actions/prepareExperience/prepareExperience.schema.mjs';
61
63
  export { ReplaceModuleAccessSchema } from './actions/replaceModuleAccess/replaceModuleAccess.schema.mjs';
62
64
  export { RefreshModuleAccessSchema } from './actions/refreshModuleAccess/refreshModuleAccess.schema.mjs';
@@ -97,6 +99,7 @@ const actions = {
97
99
  // Penilaian
98
100
  getGradingCount,
99
101
  refreshGrading,
102
+ refreshManyGrading,
100
103
  // Rasionalisasi
101
104
  addManyGradingComponent,
102
105
  calculateGrading,
@@ -123,4 +126,4 @@ const actions = {
123
126
  importData
124
127
  };
125
128
 
126
- export { acceptQuestion, actions, addManyGradingComponent, allConflict, calculateGrading, calculateManyComparator, calculateOneComparator, checkClassAttendance, classSessionInventoryOccurs, classSessionInventoryPreparation, clearAllOverrides, clearGrading, clearOneOverrides, createGradingAndScores, createManySession, customSaveOneClassSession, deleteManySession, editAnswer, generateGrading, getClassSessionConflicts, getGradingCount, getQuestionCount, getStaffId, getStaffPoint, getStudentId, getStudentPoint, getTeacherPoint, hasUnderstand, importData, notUnderstand, prepareConflict, prepareExperience, prepareMediaScanterGradingInsert, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, refreshGrading, refreshModuleAccess, replaceModuleAccess, sendAnswer, sendQuestion, setTravelWageSessions, syncClassSessions, syncCommitment, syncStudentAdmisi, syncStudentBranch, syncStudentInformation, syncStudentReport, updateGradingAndScores, updateMany, userCountStats };
129
+ export { acceptQuestion, actions, addManyGradingComponent, allConflict, calculateGrading, calculateManyComparator, calculateOneComparator, checkClassAttendance, classSessionInventoryOccurs, classSessionInventoryPreparation, clearAllOverrides, clearGrading, clearOneOverrides, createGradingAndScores, createManySession, customSaveOneClassSession, deleteManySession, editAnswer, generateGrading, getClassSessionConflicts, getGradingCount, getQuestionCount, getStaffId, getStaffPoint, getStudentId, getStudentPoint, getTeacherPoint, hasUnderstand, importData, notUnderstand, prepareConflict, prepareExperience, prepareMediaScanterGradingInsert, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, refreshGrading, refreshManyGrading, refreshModuleAccess, replaceModuleAccess, sendAnswer, sendQuestion, setTravelWageSessions, syncClassSessions, syncCommitment, syncStudentAdmisi, syncStudentBranch, syncStudentInformation, syncStudentReport, updateGradingAndScores, updateMany, userCountStats };
@@ -12,6 +12,17 @@ function usePenilaian(stream) {
12
12
  const grading = await _getOneGrading(stream2, input);
13
13
  await prepareScoreComponentMapper(stream2, grading);
14
14
  }
15
+ async function prepareManyGradingScore(stream2, input) {
16
+ utils.guard(stream2, "streamRequired");
17
+ utils.guard(input.gradingTypeId, "gradingIdRequired");
18
+ const gradings = await _getManyGrading(stream2, input);
19
+ const gradingUpdates = [];
20
+ for (const grading of gradings) {
21
+ await prepareScoreComponentMapper(stream2, grading);
22
+ gradingUpdates.push(grading);
23
+ }
24
+ await updateManyGradings(stream2, gradingUpdates);
25
+ }
15
26
  async function prepareScoreComponentMapper(stream2, grading) {
16
27
  utils.guard(stream2, "streamRequired");
17
28
  const score = grading?.data?.import?.scores;
@@ -22,6 +33,21 @@ function usePenilaian(stream) {
22
33
  }));
23
34
  await _generateScoreComponentMapper(stream2, gradingComponentMap, grading);
24
35
  }
36
+ async function updateManyGradings(stream2, gradings) {
37
+ utils.guard(stream2, "streamRequired");
38
+ for (const grading of gradings) {
39
+ await stream2?.actions.data.updateOne.execute(
40
+ {
41
+ model: "neu:penilaian:grading",
42
+ id: grading.id || "",
43
+ data: {
44
+ refreshAmount: (grading.refreshAmount || 0) + 1
45
+ }
46
+ },
47
+ stream2
48
+ );
49
+ }
50
+ }
25
51
  async function _getOneGrading(stream2, input) {
26
52
  utils.guard(stream2, "streamRequired");
27
53
  const result = await stream2.actions.data.getOne.execute({
@@ -40,9 +66,29 @@ function usePenilaian(stream) {
40
66
  throw result;
41
67
  return result.value;
42
68
  }
69
+ async function _getManyGrading(stream2, input) {
70
+ utils.guard(stream2, "streamRequired");
71
+ const result = await stream2.actions.data.getMany.execute({
72
+ model: "neu:penilaian:grading",
73
+ query: query.Query.define({
74
+ filter: { gradingTypeId: input.gradingTypeId, refreshAmount: null },
75
+ fields: {
76
+ id: 1,
77
+ data: 1,
78
+ gradingTypeId: 1,
79
+ refreshAmount: 1,
80
+ branchId: 1
81
+ }
82
+ })
83
+ }, stream2);
84
+ if (result.isFailure)
85
+ throw result;
86
+ return result.value;
87
+ }
43
88
  async function _getManyGradingComponents(stream2, input) {
44
89
  utils.guard(stream2, "streamRequired");
45
- const scoreKeys = Object.keys(input.score);
90
+ const score = input.score ?? {};
91
+ const scoreKeys = Object.keys(score);
46
92
  const result = await stream2.actions.data.getMany.execute({
47
93
  model: "neu:penilaian:gradingComponent",
48
94
  query: query.Query.define({
@@ -65,6 +111,7 @@ function usePenilaian(stream) {
65
111
  gradingId: grading?.id ? new core.ObjectId(grading?.id) : null,
66
112
  gradingComponentId: gradingComponent?.id ? new core.ObjectId(gradingComponent.id) : null,
67
113
  quantitative: gradingComponent?.quantitative ? gradingComponent.quantitative : null,
114
+ studentScoreId: Array.isArray(gradingComponent?.studentScoreId) ? gradingComponent.studentScoreId : [gradingComponent.studentScoreId],
68
115
  createdAt: /* @__PURE__ */ new Date()
69
116
  }
70
117
  }
@@ -72,9 +119,21 @@ function usePenilaian(stream) {
72
119
  }
73
120
  console.dir({ operations }, { depth: 5 });
74
121
  await stream2.core.dbs["neu-penilaian"].models["neu:penilaian:score"].bulkWrite(operations);
122
+ await stream2.actions.data.syncMany.execute(
123
+ {
124
+ model: "neu:penilaian:score",
125
+ useDry: false,
126
+ query: query.Query.define({
127
+ filter: { gradingId: grading.id },
128
+ limit: 1e4
129
+ })
130
+ },
131
+ stream2
132
+ );
75
133
  }
76
134
  return {
77
- prepareGradingScore
135
+ prepareGradingScore,
136
+ prepareManyGradingScore
78
137
  };
79
138
  }
80
139
 
@@ -3,4 +3,7 @@ export declare function usePenilaian(stream: NStream.Stream | undefined): {
3
3
  prepareGradingScore: (stream: NStream.Stream, input: {
4
4
  gradingId: string | undefined;
5
5
  }) => Promise<void>;
6
+ prepareManyGradingScore: (stream: NStream.Stream, input: {
7
+ gradingTypeId: string | undefined;
8
+ }) => Promise<void>;
6
9
  };
@@ -10,6 +10,17 @@ function usePenilaian(stream) {
10
10
  const grading = await _getOneGrading(stream2, input);
11
11
  await prepareScoreComponentMapper(stream2, grading);
12
12
  }
13
+ async function prepareManyGradingScore(stream2, input) {
14
+ guard(stream2, "streamRequired");
15
+ guard(input.gradingTypeId, "gradingIdRequired");
16
+ const gradings = await _getManyGrading(stream2, input);
17
+ const gradingUpdates = [];
18
+ for (const grading of gradings) {
19
+ await prepareScoreComponentMapper(stream2, grading);
20
+ gradingUpdates.push(grading);
21
+ }
22
+ await updateManyGradings(stream2, gradingUpdates);
23
+ }
13
24
  async function prepareScoreComponentMapper(stream2, grading) {
14
25
  guard(stream2, "streamRequired");
15
26
  const score = grading?.data?.import?.scores;
@@ -20,6 +31,21 @@ function usePenilaian(stream) {
20
31
  }));
21
32
  await _generateScoreComponentMapper(stream2, gradingComponentMap, grading);
22
33
  }
34
+ async function updateManyGradings(stream2, gradings) {
35
+ guard(stream2, "streamRequired");
36
+ for (const grading of gradings) {
37
+ await stream2?.actions.data.updateOne.execute(
38
+ {
39
+ model: "neu:penilaian:grading",
40
+ id: grading.id || "",
41
+ data: {
42
+ refreshAmount: (grading.refreshAmount || 0) + 1
43
+ }
44
+ },
45
+ stream2
46
+ );
47
+ }
48
+ }
23
49
  async function _getOneGrading(stream2, input) {
24
50
  guard(stream2, "streamRequired");
25
51
  const result = await stream2.actions.data.getOne.execute({
@@ -38,9 +64,29 @@ function usePenilaian(stream) {
38
64
  throw result;
39
65
  return result.value;
40
66
  }
67
+ async function _getManyGrading(stream2, input) {
68
+ guard(stream2, "streamRequired");
69
+ const result = await stream2.actions.data.getMany.execute({
70
+ model: "neu:penilaian:grading",
71
+ query: Query.define({
72
+ filter: { gradingTypeId: input.gradingTypeId, refreshAmount: null },
73
+ fields: {
74
+ id: 1,
75
+ data: 1,
76
+ gradingTypeId: 1,
77
+ refreshAmount: 1,
78
+ branchId: 1
79
+ }
80
+ })
81
+ }, stream2);
82
+ if (result.isFailure)
83
+ throw result;
84
+ return result.value;
85
+ }
41
86
  async function _getManyGradingComponents(stream2, input) {
42
87
  guard(stream2, "streamRequired");
43
- const scoreKeys = Object.keys(input.score);
88
+ const score = input.score ?? {};
89
+ const scoreKeys = Object.keys(score);
44
90
  const result = await stream2.actions.data.getMany.execute({
45
91
  model: "neu:penilaian:gradingComponent",
46
92
  query: Query.define({
@@ -63,6 +109,7 @@ function usePenilaian(stream) {
63
109
  gradingId: grading?.id ? new ObjectId(grading?.id) : null,
64
110
  gradingComponentId: gradingComponent?.id ? new ObjectId(gradingComponent.id) : null,
65
111
  quantitative: gradingComponent?.quantitative ? gradingComponent.quantitative : null,
112
+ studentScoreId: Array.isArray(gradingComponent?.studentScoreId) ? gradingComponent.studentScoreId : [gradingComponent.studentScoreId],
66
113
  createdAt: /* @__PURE__ */ new Date()
67
114
  }
68
115
  }
@@ -70,9 +117,21 @@ function usePenilaian(stream) {
70
117
  }
71
118
  console.dir({ operations }, { depth: 5 });
72
119
  await stream2.core.dbs["neu-penilaian"].models["neu:penilaian:score"].bulkWrite(operations);
120
+ await stream2.actions.data.syncMany.execute(
121
+ {
122
+ model: "neu:penilaian:score",
123
+ useDry: false,
124
+ query: Query.define({
125
+ filter: { gradingId: grading.id },
126
+ limit: 1e4
127
+ })
128
+ },
129
+ stream2
130
+ );
73
131
  }
74
132
  return {
75
- prepareGradingScore
133
+ prepareGradingScore,
134
+ prepareManyGradingScore
76
135
  };
77
136
  }
78
137
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutron.co.id/pendidikan-operation",
3
- "version": "1.26.6",
3
+ "version": "1.26.8",
4
4
  "description": "Operation package of Neutron Pendidikan.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "contributors": [
@@ -39,10 +39,10 @@
39
39
  "@neon.id/types": "^1.69.0",
40
40
  "@neon.id/utils": "^1.52.0",
41
41
  "@neon.id/z": "^1.16.0",
42
- "@neutron.co.id/akademik-models": "^1.19.7",
43
- "@neutron.co.id/jadwal-models": "^1.19.3",
44
- "@neutron.co.id/pendidikan-types": "^1.22.5",
45
- "@neutron.co.id/penilaian-models": "^1.17.2",
42
+ "@neutron.co.id/akademik-models": "^1.19.9",
43
+ "@neutron.co.id/jadwal-models": "^1.19.4",
44
+ "@neutron.co.id/pendidikan-types": "^1.22.8",
45
+ "@neutron.co.id/penilaian-models": "^1.17.4",
46
46
  "@neutron.co.id/personalia-models": "^1.11.6",
47
47
  "@neutron.co.id/tanya-models": "^1.13.1"
48
48
  },
@@ -73,15 +73,15 @@
73
73
  "@neon.id/types": "^1.69.0",
74
74
  "@neon.id/utils": "^1.52.0",
75
75
  "@neon.id/z": "^1.16.0",
76
- "@neutron.co.id/akademik-models": "^1.19.7",
77
- "@neutron.co.id/jadwal-models": "^1.19.3",
78
- "@neutron.co.id/pendidikan-types": "^1.22.5",
79
- "@neutron.co.id/penilaian-models": "^1.17.2",
76
+ "@neutron.co.id/akademik-models": "^1.19.9",
77
+ "@neutron.co.id/jadwal-models": "^1.19.4",
78
+ "@neutron.co.id/pendidikan-types": "^1.22.8",
79
+ "@neutron.co.id/penilaian-models": "^1.17.4",
80
80
  "@neutron.co.id/personalia-models": "^1.11.6",
81
81
  "@neutron.co.id/tanya-models": "^1.13.1"
82
82
  },
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "build": 92
86
+ "build": 94
87
87
  }