@neutron.co.id/pendidikan-operation 1.29.6 → 1.29.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/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.cjs +65 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.d.ts +13 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.mjs +63 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.cjs +10 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.d.ts +11 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.mjs +8 -0
- package/build/actions/checkStudentProgramExistance/index.d.ts +2 -0
- package/build/actions/index.d.ts +1 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.cjs +49 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.d.ts +14 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.mjs +47 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.cjs +11 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.d.ts +14 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.mjs +9 -0
- package/build/actions/penilaian/getGradingComponentByType/index.d.ts +2 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.cjs +63 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.d.ts +16 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.mjs +61 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.cjs +13 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.d.ts +20 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.mjs +11 -0
- package/build/actions/penilaian/getGradingStudent/index.d.ts +2 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.cjs +50 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.d.ts +14 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.mjs +48 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.cjs +11 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.d.ts +14 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.mjs +9 -0
- package/build/actions/penilaian/getGradingTypeByYear/index.d.ts +2 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.cjs +58 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.d.ts +13 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.mjs +56 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.cjs +10 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.d.ts +11 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.mjs +8 -0
- package/build/actions/penilaian/getScoreStudent/index.d.ts +2 -0
- package/build/actions/penilaian/index.d.ts +4 -0
- package/build/index.cjs +26 -1
- package/build/index.d.ts +25 -0
- package/build/index.mjs +17 -2
- package/build/providers/penilaian/usePenilaian.cjs +225 -43
- package/build/providers/penilaian/usePenilaian.d.ts +24 -0
- package/build/providers/penilaian/usePenilaian.mjs +225 -43
- package/package.json +4 -4
|
@@ -30,12 +30,17 @@ function usePenilaian(stream) {
|
|
|
30
30
|
console.log("grading: ", grading);
|
|
31
31
|
const parsedScores = Object.fromEntries(
|
|
32
32
|
Object.entries(grading?.data?.import?.scores).map(([key, value]) => {
|
|
33
|
-
const normalizedValue = Number.parseFloat(
|
|
33
|
+
const normalizedValue = Number.parseFloat(
|
|
34
|
+
String(value).replace(",", ".")
|
|
35
|
+
);
|
|
34
36
|
return [key, Number.isNaN(normalizedValue) ? null : normalizedValue];
|
|
35
37
|
})
|
|
36
38
|
);
|
|
37
39
|
const score = parsedScores;
|
|
38
|
-
const gradingComponent = await _getManyGradingComponents(stream2, {
|
|
40
|
+
const gradingComponent = await _getManyGradingComponents(stream2, {
|
|
41
|
+
gradingTypeId: grading?.gradingTypeId,
|
|
42
|
+
score
|
|
43
|
+
});
|
|
39
44
|
const gradingComponentMap = gradingComponent.map((item) => ({
|
|
40
45
|
...item,
|
|
41
46
|
quantitative: score[item?.code]
|
|
@@ -75,45 +80,56 @@ function usePenilaian(stream) {
|
|
|
75
80
|
}
|
|
76
81
|
async function _getOneGrading(stream2, input) {
|
|
77
82
|
utils.guard(stream2, "streamRequired");
|
|
78
|
-
const result = await stream2.actions.data.getOne.execute(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
const result = await stream2.actions.data.getOne.execute(
|
|
84
|
+
{
|
|
85
|
+
model: "neu:penilaian:grading",
|
|
86
|
+
id: input.gradingId,
|
|
87
|
+
query: query.Query.define({
|
|
88
|
+
fields: {
|
|
89
|
+
id: 1,
|
|
90
|
+
data: 1,
|
|
91
|
+
gradingTypeId: 1,
|
|
92
|
+
student: {
|
|
93
|
+
branchIds: 1
|
|
94
|
+
},
|
|
95
|
+
branchId: 1
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
stream2
|
|
100
|
+
);
|
|
93
101
|
if (result.isFailure)
|
|
94
102
|
throw result;
|
|
95
103
|
return result.value;
|
|
96
104
|
}
|
|
97
105
|
async function _getManyGrading(stream2, input) {
|
|
98
106
|
utils.guard(stream2, "streamRequired");
|
|
99
|
-
const result = await stream2.actions.data.getMany.execute(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
gradingTypeId: 1,
|
|
109
|
-
student: {
|
|
110
|
-
branchIds: 1
|
|
107
|
+
const result = await stream2.actions.data.getMany.execute(
|
|
108
|
+
{
|
|
109
|
+
model: "neu:penilaian:grading",
|
|
110
|
+
query: query.Query.define({
|
|
111
|
+
filter: {
|
|
112
|
+
gradingTypeId: input.gradingTypeId,
|
|
113
|
+
createdAt: { $gt: /* @__PURE__ */ new Date("2024-12-27T00:00:00Z") },
|
|
114
|
+
refreshAmount: null,
|
|
115
|
+
data: { $exists: true }
|
|
111
116
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
limit: constants.LIMIT_INFINITY,
|
|
118
|
+
fields: {
|
|
119
|
+
id: 1,
|
|
120
|
+
createdAt: 1,
|
|
121
|
+
data: 1,
|
|
122
|
+
gradingTypeId: 1,
|
|
123
|
+
student: {
|
|
124
|
+
branchIds: 1
|
|
125
|
+
},
|
|
126
|
+
refreshAmount: 1,
|
|
127
|
+
branchId: 1
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
stream2
|
|
132
|
+
);
|
|
117
133
|
if (result.isFailure)
|
|
118
134
|
throw result;
|
|
119
135
|
return result.value;
|
|
@@ -122,14 +138,20 @@ function usePenilaian(stream) {
|
|
|
122
138
|
utils.guard(stream2, "streamRequired");
|
|
123
139
|
const score = input.score ?? {};
|
|
124
140
|
const scoreKeys = Object.keys(score);
|
|
125
|
-
const result = await stream2.actions.data.getMany.execute(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
const result = await stream2.actions.data.getMany.execute(
|
|
142
|
+
{
|
|
143
|
+
model: "neu:penilaian:gradingComponent",
|
|
144
|
+
query: query.Query.define({
|
|
145
|
+
filter: {
|
|
146
|
+
code: { $in: scoreKeys },
|
|
147
|
+
gradingTypeId: input.gradingTypeId
|
|
148
|
+
},
|
|
149
|
+
limit: constants.LIMIT_INFINITY,
|
|
150
|
+
fields: { id: 1, name: 1, code: 1, gradingId: 1 }
|
|
151
|
+
})
|
|
152
|
+
},
|
|
153
|
+
stream2
|
|
154
|
+
);
|
|
133
155
|
if (result.isFailure)
|
|
134
156
|
throw result;
|
|
135
157
|
return result.value;
|
|
@@ -165,9 +187,169 @@ function usePenilaian(stream) {
|
|
|
165
187
|
stream2
|
|
166
188
|
);
|
|
167
189
|
}
|
|
190
|
+
function metaBuilder(input) {
|
|
191
|
+
return {
|
|
192
|
+
limit: input.limit,
|
|
193
|
+
page: input.page,
|
|
194
|
+
total: input.items.length,
|
|
195
|
+
totalPage: Math.ceil(input.items.length / input.limit)
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
async function getManyGradingTypes(stream2, year, limit, page) {
|
|
199
|
+
const actions = stream2.actions.data;
|
|
200
|
+
const result = await actions.getMany.execute(
|
|
201
|
+
{
|
|
202
|
+
model: "neu:penilaian:gradingType",
|
|
203
|
+
query: query.Query.define({
|
|
204
|
+
filter: {
|
|
205
|
+
year
|
|
206
|
+
},
|
|
207
|
+
fields: {
|
|
208
|
+
id: 1,
|
|
209
|
+
name: 1
|
|
210
|
+
},
|
|
211
|
+
limit,
|
|
212
|
+
page
|
|
213
|
+
})
|
|
214
|
+
},
|
|
215
|
+
stream2
|
|
216
|
+
);
|
|
217
|
+
if (result.isFailure)
|
|
218
|
+
throw result;
|
|
219
|
+
return {
|
|
220
|
+
items: result.value,
|
|
221
|
+
meta: metaBuilder({
|
|
222
|
+
items: result.value,
|
|
223
|
+
limit,
|
|
224
|
+
page
|
|
225
|
+
})
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async function getManyGradingComponent(stream2, gradingTypeId, limit, page) {
|
|
229
|
+
const actions = stream2.actions.data;
|
|
230
|
+
const result = await actions.getMany.execute(
|
|
231
|
+
{
|
|
232
|
+
model: "neu:penilaian:gradingComponent",
|
|
233
|
+
query: query.Query.define({
|
|
234
|
+
filter: {
|
|
235
|
+
gradingTypeId
|
|
236
|
+
},
|
|
237
|
+
fields: {
|
|
238
|
+
id: 1,
|
|
239
|
+
name: 1
|
|
240
|
+
},
|
|
241
|
+
limit,
|
|
242
|
+
page
|
|
243
|
+
})
|
|
244
|
+
},
|
|
245
|
+
stream2
|
|
246
|
+
);
|
|
247
|
+
if (result.isFailure)
|
|
248
|
+
throw result;
|
|
249
|
+
return {
|
|
250
|
+
items: result.value,
|
|
251
|
+
meta: metaBuilder({
|
|
252
|
+
items: result.value,
|
|
253
|
+
limit,
|
|
254
|
+
page
|
|
255
|
+
})
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
async function getManyGradingByStudent(stream2, studentId, gradingTypeId, branchId, limit, page) {
|
|
259
|
+
const actions = stream2.actions.data;
|
|
260
|
+
const result = await actions.getMany.execute(
|
|
261
|
+
{
|
|
262
|
+
model: "neu:penilaian:grading",
|
|
263
|
+
query: query.Query.define({
|
|
264
|
+
filter: {
|
|
265
|
+
studentId,
|
|
266
|
+
gradingTypeId,
|
|
267
|
+
branchId
|
|
268
|
+
},
|
|
269
|
+
fields: {
|
|
270
|
+
id: 1,
|
|
271
|
+
description: 1
|
|
272
|
+
},
|
|
273
|
+
limit,
|
|
274
|
+
page
|
|
275
|
+
})
|
|
276
|
+
},
|
|
277
|
+
stream2
|
|
278
|
+
);
|
|
279
|
+
if (result.isFailure)
|
|
280
|
+
throw result;
|
|
281
|
+
return {
|
|
282
|
+
items: result.value,
|
|
283
|
+
meta: metaBuilder({
|
|
284
|
+
items: result.value,
|
|
285
|
+
limit,
|
|
286
|
+
page
|
|
287
|
+
})
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
async function getScoresByGrading(stream2, gradingId, studentId) {
|
|
291
|
+
utils.guard(gradingId, "gradingIdRequired");
|
|
292
|
+
utils.guard(studentId, "studentIdRequired");
|
|
293
|
+
const actions = stream2.actions.data;
|
|
294
|
+
const gradingResult = await actions.getOne.execute(
|
|
295
|
+
{
|
|
296
|
+
model: "neu:penilaian:grading",
|
|
297
|
+
id: gradingId,
|
|
298
|
+
query: query.Query.define({
|
|
299
|
+
fields: {
|
|
300
|
+
id: 1,
|
|
301
|
+
studentId: 1,
|
|
302
|
+
student: {
|
|
303
|
+
id: 1,
|
|
304
|
+
name: 1
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
},
|
|
309
|
+
stream2
|
|
310
|
+
);
|
|
311
|
+
if (gradingResult.isFailure)
|
|
312
|
+
throw gradingResult;
|
|
313
|
+
const grading = gradingResult.value;
|
|
314
|
+
const scoresResult = await actions.getMany.execute(
|
|
315
|
+
{
|
|
316
|
+
model: "neu:penilaian:score",
|
|
317
|
+
query: query.Query.define({
|
|
318
|
+
filter: { gradingId },
|
|
319
|
+
limit: constants.LIMIT_INFINITY,
|
|
320
|
+
fields: {
|
|
321
|
+
id: 1,
|
|
322
|
+
gradingComponentId: 1,
|
|
323
|
+
quantitative: 1
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
},
|
|
327
|
+
stream2
|
|
328
|
+
);
|
|
329
|
+
if (scoresResult.isFailure)
|
|
330
|
+
throw scoresResult;
|
|
331
|
+
const scores = scoresResult.value;
|
|
332
|
+
const data = {};
|
|
333
|
+
for (const score of scores) {
|
|
334
|
+
if (score.gradingComponentId) {
|
|
335
|
+
data[score.gradingComponentId] = score.quantitative ?? null;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return [
|
|
339
|
+
{
|
|
340
|
+
studentId: grading.studentId ?? null,
|
|
341
|
+
studentName: grading.student?.name ?? null,
|
|
342
|
+
data
|
|
343
|
+
}
|
|
344
|
+
];
|
|
345
|
+
}
|
|
168
346
|
return {
|
|
169
347
|
prepareGradingScore,
|
|
170
|
-
prepareManyGradingScore
|
|
348
|
+
prepareManyGradingScore,
|
|
349
|
+
getManyGradingTypes,
|
|
350
|
+
getManyGradingComponent,
|
|
351
|
+
getManyGradingByStudent,
|
|
352
|
+
getScoresByGrading
|
|
171
353
|
};
|
|
172
354
|
}
|
|
173
355
|
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { NStream } from '@neon.id/types';
|
|
2
|
+
import type { Schema } from '@neutron.co.id/pendidikan-types';
|
|
3
|
+
export interface TMeta {
|
|
4
|
+
limit: number;
|
|
5
|
+
page: number;
|
|
6
|
+
total: number;
|
|
7
|
+
totalPage: number;
|
|
8
|
+
}
|
|
2
9
|
export declare function usePenilaian(stream: NStream.Stream | undefined): {
|
|
3
10
|
prepareGradingScore: (stream: NStream.Stream, input: {
|
|
4
11
|
gradingId: string | undefined;
|
|
@@ -6,4 +13,21 @@ export declare function usePenilaian(stream: NStream.Stream | undefined): {
|
|
|
6
13
|
prepareManyGradingScore: (stream: NStream.Stream, input: {
|
|
7
14
|
gradingTypeId: string | undefined;
|
|
8
15
|
}) => Promise<void>;
|
|
16
|
+
getManyGradingTypes: (stream: NStream.Stream, year: string, limit: number, page: number) => Promise<{
|
|
17
|
+
items: Schema.GradingType[];
|
|
18
|
+
meta: TMeta;
|
|
19
|
+
}>;
|
|
20
|
+
getManyGradingComponent: (stream: NStream.Stream, gradingTypeId: string, limit: number, page: number) => Promise<{
|
|
21
|
+
items: Schema.GradingComponent[];
|
|
22
|
+
meta: TMeta;
|
|
23
|
+
}>;
|
|
24
|
+
getManyGradingByStudent: (stream: NStream.Stream, studentId: string, gradingTypeId: string, branchId: string, limit: number, page: number) => Promise<{
|
|
25
|
+
items: Schema.Grading[];
|
|
26
|
+
meta: TMeta;
|
|
27
|
+
}>;
|
|
28
|
+
getScoresByGrading: (stream: NStream.Stream, gradingId: string, studentId: string) => Promise<Array<{
|
|
29
|
+
studentId: string | null;
|
|
30
|
+
studentName: string | null;
|
|
31
|
+
data: Record<string, number | null>;
|
|
32
|
+
}>>;
|
|
9
33
|
};
|
|
@@ -28,12 +28,17 @@ function usePenilaian(stream) {
|
|
|
28
28
|
console.log("grading: ", grading);
|
|
29
29
|
const parsedScores = Object.fromEntries(
|
|
30
30
|
Object.entries(grading?.data?.import?.scores).map(([key, value]) => {
|
|
31
|
-
const normalizedValue = Number.parseFloat(
|
|
31
|
+
const normalizedValue = Number.parseFloat(
|
|
32
|
+
String(value).replace(",", ".")
|
|
33
|
+
);
|
|
32
34
|
return [key, Number.isNaN(normalizedValue) ? null : normalizedValue];
|
|
33
35
|
})
|
|
34
36
|
);
|
|
35
37
|
const score = parsedScores;
|
|
36
|
-
const gradingComponent = await _getManyGradingComponents(stream2, {
|
|
38
|
+
const gradingComponent = await _getManyGradingComponents(stream2, {
|
|
39
|
+
gradingTypeId: grading?.gradingTypeId,
|
|
40
|
+
score
|
|
41
|
+
});
|
|
37
42
|
const gradingComponentMap = gradingComponent.map((item) => ({
|
|
38
43
|
...item,
|
|
39
44
|
quantitative: score[item?.code]
|
|
@@ -73,45 +78,56 @@ function usePenilaian(stream) {
|
|
|
73
78
|
}
|
|
74
79
|
async function _getOneGrading(stream2, input) {
|
|
75
80
|
guard(stream2, "streamRequired");
|
|
76
|
-
const result = await stream2.actions.data.getOne.execute(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
const result = await stream2.actions.data.getOne.execute(
|
|
82
|
+
{
|
|
83
|
+
model: "neu:penilaian:grading",
|
|
84
|
+
id: input.gradingId,
|
|
85
|
+
query: Query.define({
|
|
86
|
+
fields: {
|
|
87
|
+
id: 1,
|
|
88
|
+
data: 1,
|
|
89
|
+
gradingTypeId: 1,
|
|
90
|
+
student: {
|
|
91
|
+
branchIds: 1
|
|
92
|
+
},
|
|
93
|
+
branchId: 1
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
stream2
|
|
98
|
+
);
|
|
91
99
|
if (result.isFailure)
|
|
92
100
|
throw result;
|
|
93
101
|
return result.value;
|
|
94
102
|
}
|
|
95
103
|
async function _getManyGrading(stream2, input) {
|
|
96
104
|
guard(stream2, "streamRequired");
|
|
97
|
-
const result = await stream2.actions.data.getMany.execute(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
gradingTypeId: 1,
|
|
107
|
-
student: {
|
|
108
|
-
branchIds: 1
|
|
105
|
+
const result = await stream2.actions.data.getMany.execute(
|
|
106
|
+
{
|
|
107
|
+
model: "neu:penilaian:grading",
|
|
108
|
+
query: Query.define({
|
|
109
|
+
filter: {
|
|
110
|
+
gradingTypeId: input.gradingTypeId,
|
|
111
|
+
createdAt: { $gt: /* @__PURE__ */ new Date("2024-12-27T00:00:00Z") },
|
|
112
|
+
refreshAmount: null,
|
|
113
|
+
data: { $exists: true }
|
|
109
114
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
limit: LIMIT_INFINITY,
|
|
116
|
+
fields: {
|
|
117
|
+
id: 1,
|
|
118
|
+
createdAt: 1,
|
|
119
|
+
data: 1,
|
|
120
|
+
gradingTypeId: 1,
|
|
121
|
+
student: {
|
|
122
|
+
branchIds: 1
|
|
123
|
+
},
|
|
124
|
+
refreshAmount: 1,
|
|
125
|
+
branchId: 1
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
stream2
|
|
130
|
+
);
|
|
115
131
|
if (result.isFailure)
|
|
116
132
|
throw result;
|
|
117
133
|
return result.value;
|
|
@@ -120,14 +136,20 @@ function usePenilaian(stream) {
|
|
|
120
136
|
guard(stream2, "streamRequired");
|
|
121
137
|
const score = input.score ?? {};
|
|
122
138
|
const scoreKeys = Object.keys(score);
|
|
123
|
-
const result = await stream2.actions.data.getMany.execute(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
const result = await stream2.actions.data.getMany.execute(
|
|
140
|
+
{
|
|
141
|
+
model: "neu:penilaian:gradingComponent",
|
|
142
|
+
query: Query.define({
|
|
143
|
+
filter: {
|
|
144
|
+
code: { $in: scoreKeys },
|
|
145
|
+
gradingTypeId: input.gradingTypeId
|
|
146
|
+
},
|
|
147
|
+
limit: LIMIT_INFINITY,
|
|
148
|
+
fields: { id: 1, name: 1, code: 1, gradingId: 1 }
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
stream2
|
|
152
|
+
);
|
|
131
153
|
if (result.isFailure)
|
|
132
154
|
throw result;
|
|
133
155
|
return result.value;
|
|
@@ -163,9 +185,169 @@ function usePenilaian(stream) {
|
|
|
163
185
|
stream2
|
|
164
186
|
);
|
|
165
187
|
}
|
|
188
|
+
function metaBuilder(input) {
|
|
189
|
+
return {
|
|
190
|
+
limit: input.limit,
|
|
191
|
+
page: input.page,
|
|
192
|
+
total: input.items.length,
|
|
193
|
+
totalPage: Math.ceil(input.items.length / input.limit)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
async function getManyGradingTypes(stream2, year, limit, page) {
|
|
197
|
+
const actions = stream2.actions.data;
|
|
198
|
+
const result = await actions.getMany.execute(
|
|
199
|
+
{
|
|
200
|
+
model: "neu:penilaian:gradingType",
|
|
201
|
+
query: Query.define({
|
|
202
|
+
filter: {
|
|
203
|
+
year
|
|
204
|
+
},
|
|
205
|
+
fields: {
|
|
206
|
+
id: 1,
|
|
207
|
+
name: 1
|
|
208
|
+
},
|
|
209
|
+
limit,
|
|
210
|
+
page
|
|
211
|
+
})
|
|
212
|
+
},
|
|
213
|
+
stream2
|
|
214
|
+
);
|
|
215
|
+
if (result.isFailure)
|
|
216
|
+
throw result;
|
|
217
|
+
return {
|
|
218
|
+
items: result.value,
|
|
219
|
+
meta: metaBuilder({
|
|
220
|
+
items: result.value,
|
|
221
|
+
limit,
|
|
222
|
+
page
|
|
223
|
+
})
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async function getManyGradingComponent(stream2, gradingTypeId, limit, page) {
|
|
227
|
+
const actions = stream2.actions.data;
|
|
228
|
+
const result = await actions.getMany.execute(
|
|
229
|
+
{
|
|
230
|
+
model: "neu:penilaian:gradingComponent",
|
|
231
|
+
query: Query.define({
|
|
232
|
+
filter: {
|
|
233
|
+
gradingTypeId
|
|
234
|
+
},
|
|
235
|
+
fields: {
|
|
236
|
+
id: 1,
|
|
237
|
+
name: 1
|
|
238
|
+
},
|
|
239
|
+
limit,
|
|
240
|
+
page
|
|
241
|
+
})
|
|
242
|
+
},
|
|
243
|
+
stream2
|
|
244
|
+
);
|
|
245
|
+
if (result.isFailure)
|
|
246
|
+
throw result;
|
|
247
|
+
return {
|
|
248
|
+
items: result.value,
|
|
249
|
+
meta: metaBuilder({
|
|
250
|
+
items: result.value,
|
|
251
|
+
limit,
|
|
252
|
+
page
|
|
253
|
+
})
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
async function getManyGradingByStudent(stream2, studentId, gradingTypeId, branchId, limit, page) {
|
|
257
|
+
const actions = stream2.actions.data;
|
|
258
|
+
const result = await actions.getMany.execute(
|
|
259
|
+
{
|
|
260
|
+
model: "neu:penilaian:grading",
|
|
261
|
+
query: Query.define({
|
|
262
|
+
filter: {
|
|
263
|
+
studentId,
|
|
264
|
+
gradingTypeId,
|
|
265
|
+
branchId
|
|
266
|
+
},
|
|
267
|
+
fields: {
|
|
268
|
+
id: 1,
|
|
269
|
+
description: 1
|
|
270
|
+
},
|
|
271
|
+
limit,
|
|
272
|
+
page
|
|
273
|
+
})
|
|
274
|
+
},
|
|
275
|
+
stream2
|
|
276
|
+
);
|
|
277
|
+
if (result.isFailure)
|
|
278
|
+
throw result;
|
|
279
|
+
return {
|
|
280
|
+
items: result.value,
|
|
281
|
+
meta: metaBuilder({
|
|
282
|
+
items: result.value,
|
|
283
|
+
limit,
|
|
284
|
+
page
|
|
285
|
+
})
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
async function getScoresByGrading(stream2, gradingId, studentId) {
|
|
289
|
+
guard(gradingId, "gradingIdRequired");
|
|
290
|
+
guard(studentId, "studentIdRequired");
|
|
291
|
+
const actions = stream2.actions.data;
|
|
292
|
+
const gradingResult = await actions.getOne.execute(
|
|
293
|
+
{
|
|
294
|
+
model: "neu:penilaian:grading",
|
|
295
|
+
id: gradingId,
|
|
296
|
+
query: Query.define({
|
|
297
|
+
fields: {
|
|
298
|
+
id: 1,
|
|
299
|
+
studentId: 1,
|
|
300
|
+
student: {
|
|
301
|
+
id: 1,
|
|
302
|
+
name: 1
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
},
|
|
307
|
+
stream2
|
|
308
|
+
);
|
|
309
|
+
if (gradingResult.isFailure)
|
|
310
|
+
throw gradingResult;
|
|
311
|
+
const grading = gradingResult.value;
|
|
312
|
+
const scoresResult = await actions.getMany.execute(
|
|
313
|
+
{
|
|
314
|
+
model: "neu:penilaian:score",
|
|
315
|
+
query: Query.define({
|
|
316
|
+
filter: { gradingId },
|
|
317
|
+
limit: LIMIT_INFINITY,
|
|
318
|
+
fields: {
|
|
319
|
+
id: 1,
|
|
320
|
+
gradingComponentId: 1,
|
|
321
|
+
quantitative: 1
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
},
|
|
325
|
+
stream2
|
|
326
|
+
);
|
|
327
|
+
if (scoresResult.isFailure)
|
|
328
|
+
throw scoresResult;
|
|
329
|
+
const scores = scoresResult.value;
|
|
330
|
+
const data = {};
|
|
331
|
+
for (const score of scores) {
|
|
332
|
+
if (score.gradingComponentId) {
|
|
333
|
+
data[score.gradingComponentId] = score.quantitative ?? null;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return [
|
|
337
|
+
{
|
|
338
|
+
studentId: grading.studentId ?? null,
|
|
339
|
+
studentName: grading.student?.name ?? null,
|
|
340
|
+
data
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
}
|
|
166
344
|
return {
|
|
167
345
|
prepareGradingScore,
|
|
168
|
-
prepareManyGradingScore
|
|
346
|
+
prepareManyGradingScore,
|
|
347
|
+
getManyGradingTypes,
|
|
348
|
+
getManyGradingComponent,
|
|
349
|
+
getManyGradingByStudent,
|
|
350
|
+
getScoresByGrading
|
|
169
351
|
};
|
|
170
352
|
}
|
|
171
353
|
|
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.8",
|
|
4
4
|
"description": "Operation package of Neutron Pendidikan.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"contributors": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@neutron.co.id/akademik-models": "^1.21.5",
|
|
43
43
|
"@neutron.co.id/jadwal-models": "^1.19.13",
|
|
44
44
|
"@neutron.co.id/pendidikan-types": "^1.24.1",
|
|
45
|
-
"@neutron.co.id/penilaian-models": "^1.19.
|
|
45
|
+
"@neutron.co.id/penilaian-models": "^1.19.1",
|
|
46
46
|
"@neutron.co.id/personalia-models": "^1.11.6",
|
|
47
47
|
"@neutron.co.id/tanya-models": "^1.13.4",
|
|
48
48
|
"@sentry/node": "8.19.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@neutron.co.id/akademik-models": "^1.21.5",
|
|
79
79
|
"@neutron.co.id/jadwal-models": "^1.19.13",
|
|
80
80
|
"@neutron.co.id/pendidikan-types": "^1.24.1",
|
|
81
|
-
"@neutron.co.id/penilaian-models": "^1.19.
|
|
81
|
+
"@neutron.co.id/penilaian-models": "^1.19.1",
|
|
82
82
|
"@neutron.co.id/personalia-models": "^1.11.6",
|
|
83
83
|
"@neutron.co.id/tanya-models": "^1.13.4",
|
|
84
84
|
"@sentry/node": "8.19.0"
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"build":
|
|
89
|
+
"build": 164
|
|
90
90
|
}
|