@neutron.co.id/pendidikan-operation 1.27.29 → 1.29.1

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.
@@ -67,6 +67,7 @@ function useImportData(stream) {
67
67
  document: {
68
68
  branchId: Array.isArray(student?.branchIds) && student.branchIds[0] ? new core.ObjectId(student.branchIds[0]) : null,
69
69
  studentId: student?.id ? new core.ObjectId(student.id) : null,
70
+ branchIds: student.branchIds || [],
70
71
  stageId: student?.stageId ? new core.ObjectId(student.stageId) : null,
71
72
  reportedAt: /* @__PURE__ */ new Date(),
72
73
  createdAt: /* @__PURE__ */ new Date(),
@@ -65,6 +65,7 @@ function useImportData(stream) {
65
65
  document: {
66
66
  branchId: Array.isArray(student?.branchIds) && student.branchIds[0] ? new ObjectId(student.branchIds[0]) : null,
67
67
  studentId: student?.id ? new ObjectId(student.id) : null,
68
+ branchIds: student.branchIds || [],
68
69
  stageId: student?.stageId ? new ObjectId(student.stageId) : null,
69
70
  reportedAt: /* @__PURE__ */ new Date(),
70
71
  createdAt: /* @__PURE__ */ new Date(),
@@ -12,6 +12,7 @@ function usePenilaian(stream) {
12
12
  utils.guard(input.gradingId, "gradingIdRequired");
13
13
  const grading = await _getOneGrading(stream2, input);
14
14
  await prepareScoreComponentMapper(stream2, grading);
15
+ await updateOneGrading(stream2, grading);
15
16
  }
16
17
  async function prepareManyGradingScore(stream2, input) {
17
18
  utils.guard(stream2, "streamRequired");
@@ -26,6 +27,7 @@ function usePenilaian(stream) {
26
27
  }
27
28
  async function prepareScoreComponentMapper(stream2, grading) {
28
29
  utils.guard(stream2, "streamRequired");
30
+ console.log("grading: ", grading);
29
31
  const parsedScores = Object.fromEntries(
30
32
  Object.entries(grading?.data?.import?.scores).map(([key, value]) => {
31
33
  const normalizedValue = Number.parseFloat(String(value).replace(",", "."));
@@ -40,14 +42,30 @@ function usePenilaian(stream) {
40
42
  }));
41
43
  await _generateScoreComponentMapper(stream2, gradingComponentMap, grading);
42
44
  }
45
+ async function updateOneGrading(stream2, grading) {
46
+ utils.guard(stream2, "streamRequired");
47
+ await stream2?.actions.data.updateOne.execute(
48
+ {
49
+ model: "neu:penilaian:grading",
50
+ id: grading.id || "",
51
+ data: {
52
+ branchIds: grading.student?.branchIds,
53
+ refreshAmount: (grading.refreshAmount || 0) + 1
54
+ }
55
+ },
56
+ stream2
57
+ );
58
+ }
43
59
  async function updateManyGradings(stream2, gradings) {
44
60
  utils.guard(stream2, "streamRequired");
45
61
  for (const grading of gradings) {
62
+ console.log("grading branches: ", grading.student?.branchIds);
46
63
  await stream2?.actions.data.updateOne.execute(
47
64
  {
48
65
  model: "neu:penilaian:grading",
49
66
  id: grading.id || "",
50
67
  data: {
68
+ branchIds: grading.student?.branchIds,
51
69
  refreshAmount: (grading.refreshAmount || 0) + 1
52
70
  }
53
71
  },
@@ -65,6 +83,9 @@ function usePenilaian(stream) {
65
83
  id: 1,
66
84
  data: 1,
67
85
  gradingTypeId: 1,
86
+ student: {
87
+ branchIds: 1
88
+ },
68
89
  branchId: 1
69
90
  }
70
91
  })
@@ -85,6 +106,9 @@ function usePenilaian(stream) {
85
106
  createdAt: 1,
86
107
  data: 1,
87
108
  gradingTypeId: 1,
109
+ student: {
110
+ branchIds: 1
111
+ },
88
112
  refreshAmount: 1,
89
113
  branchId: 1
90
114
  }
@@ -10,6 +10,7 @@ function usePenilaian(stream) {
10
10
  guard(input.gradingId, "gradingIdRequired");
11
11
  const grading = await _getOneGrading(stream2, input);
12
12
  await prepareScoreComponentMapper(stream2, grading);
13
+ await updateOneGrading(stream2, grading);
13
14
  }
14
15
  async function prepareManyGradingScore(stream2, input) {
15
16
  guard(stream2, "streamRequired");
@@ -24,6 +25,7 @@ function usePenilaian(stream) {
24
25
  }
25
26
  async function prepareScoreComponentMapper(stream2, grading) {
26
27
  guard(stream2, "streamRequired");
28
+ console.log("grading: ", grading);
27
29
  const parsedScores = Object.fromEntries(
28
30
  Object.entries(grading?.data?.import?.scores).map(([key, value]) => {
29
31
  const normalizedValue = Number.parseFloat(String(value).replace(",", "."));
@@ -38,14 +40,30 @@ function usePenilaian(stream) {
38
40
  }));
39
41
  await _generateScoreComponentMapper(stream2, gradingComponentMap, grading);
40
42
  }
43
+ async function updateOneGrading(stream2, grading) {
44
+ guard(stream2, "streamRequired");
45
+ await stream2?.actions.data.updateOne.execute(
46
+ {
47
+ model: "neu:penilaian:grading",
48
+ id: grading.id || "",
49
+ data: {
50
+ branchIds: grading.student?.branchIds,
51
+ refreshAmount: (grading.refreshAmount || 0) + 1
52
+ }
53
+ },
54
+ stream2
55
+ );
56
+ }
41
57
  async function updateManyGradings(stream2, gradings) {
42
58
  guard(stream2, "streamRequired");
43
59
  for (const grading of gradings) {
60
+ console.log("grading branches: ", grading.student?.branchIds);
44
61
  await stream2?.actions.data.updateOne.execute(
45
62
  {
46
63
  model: "neu:penilaian:grading",
47
64
  id: grading.id || "",
48
65
  data: {
66
+ branchIds: grading.student?.branchIds,
49
67
  refreshAmount: (grading.refreshAmount || 0) + 1
50
68
  }
51
69
  },
@@ -63,6 +81,9 @@ function usePenilaian(stream) {
63
81
  id: 1,
64
82
  data: 1,
65
83
  gradingTypeId: 1,
84
+ student: {
85
+ branchIds: 1
86
+ },
66
87
  branchId: 1
67
88
  }
68
89
  })
@@ -83,6 +104,9 @@ function usePenilaian(stream) {
83
104
  createdAt: 1,
84
105
  data: 1,
85
106
  gradingTypeId: 1,
107
+ student: {
108
+ branchIds: 1
109
+ },
86
110
  refreshAmount: 1,
87
111
  branchId: 1
88
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutron.co.id/pendidikan-operation",
3
- "version": "1.27.29",
3
+ "version": "1.29.1",
4
4
  "description": "Operation package of Neutron Pendidikan.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "contributors": [
@@ -41,15 +41,15 @@
41
41
  "@neon.id/z": "^1.16.0",
42
42
  "@neutron.co.id/akademik-models": "^1.21.5-beta.1",
43
43
  "@neutron.co.id/jadwal-models": "^1.19.13",
44
- "@neutron.co.id/pendidikan-types": "^1.23.3",
45
- "@neutron.co.id/penilaian-models": "^1.17.8",
44
+ "@neutron.co.id/pendidikan-types": "^1.24.1",
45
+ "@neutron.co.id/penilaian-models": "^1.19.0",
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",
49
49
  "node-cron": "^4.1.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@neon.id/cli": "0.23.0",
52
+ "@neon.co.id/cli": "0.1.0",
53
53
  "@neon.id/eslint": "0.3.0",
54
54
  "@neon.id/mock": "1.3.0",
55
55
  "@types/eslint": "9.6.0",
@@ -77,8 +77,8 @@
77
77
  "@neon.id/z": "^1.16.0",
78
78
  "@neutron.co.id/akademik-models": "^1.21.5-beta.1",
79
79
  "@neutron.co.id/jadwal-models": "^1.19.13",
80
- "@neutron.co.id/pendidikan-types": "^1.23.3",
81
- "@neutron.co.id/penilaian-models": "^1.17.8",
80
+ "@neutron.co.id/pendidikan-types": "^1.24.1",
81
+ "@neutron.co.id/penilaian-models": "^1.19.0",
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": 154
89
+ "build": 157
90
90
  }