@kipicore/dbcore 1.1.300 → 1.1.301
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.
|
@@ -257,24 +257,28 @@ const createOrUpdateHook = async (examGroup) => {
|
|
|
257
257
|
// }
|
|
258
258
|
}
|
|
259
259
|
//*********** days array remove duplicate date from date if multiple date empty ********///
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
days
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
260
|
+
const dateListTimestamp = dateList.map(date => new Date(date).getTime());
|
|
261
|
+
examGroup.standardByDays = examGroup.standardByDays.map(standard => {
|
|
262
|
+
standard.days = standard.days.filter(day => dateListTimestamp.includes(new Date(day.date).getTime()));
|
|
263
|
+
return {
|
|
264
|
+
...standard,
|
|
265
|
+
days: standard.days.reduce((acc, day) => {
|
|
266
|
+
const existingIndex = acc.findIndex(d => new Date(d.date).getTime() === new Date(day.date).getTime());
|
|
267
|
+
if (Object.keys(day.examDetails || {}).length > 0) {
|
|
268
|
+
// If an empty object exists for this date, remove it
|
|
269
|
+
if (existingIndex !== -1 && Object.keys(acc[existingIndex].examDetails || {}).length === 0) {
|
|
270
|
+
acc.splice(existingIndex, 1);
|
|
271
|
+
}
|
|
272
|
+
acc.push(day);
|
|
268
273
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
acc
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}));
|
|
274
|
+
else if (existingIndex === -1) {
|
|
275
|
+
// Push empty examDetails object only if there's no existing entry
|
|
276
|
+
acc.push(day);
|
|
277
|
+
}
|
|
278
|
+
return acc;
|
|
279
|
+
}, []),
|
|
280
|
+
};
|
|
281
|
+
});
|
|
278
282
|
}
|
|
279
283
|
}
|
|
280
284
|
catch (err) {
|
package/package.json
CHANGED