@lyxa.ai/core 1.3.1 → 1.3.2
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/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -5,7 +5,9 @@ const enum_1 = require("./enum");
|
|
|
5
5
|
function groupRidersByLanguage(riderAssignments, assignRiders) {
|
|
6
6
|
const englishRiders = [];
|
|
7
7
|
const arabicRiders = [];
|
|
8
|
-
const rejectedRiderIds = new Set(riderAssignments
|
|
8
|
+
const rejectedRiderIds = new Set(riderAssignments
|
|
9
|
+
.filter(a => [enum_1.RiderAssignmentStatus.REJECTED, enum_1.RiderAssignmentStatus.CANCELLED].includes(a.status))
|
|
10
|
+
.map(a => a.rider.toString()));
|
|
9
11
|
for (const { _id, language } of assignRiders) {
|
|
10
12
|
if (!_id || rejectedRiderIds.has(_id.toString()))
|
|
11
13
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-rider.js","sourceRoot":"/","sources":["utilities/group-rider.ts"],"names":[],"mappings":";;AAQA,
|
|
1
|
+
{"version":3,"file":"group-rider.js","sourceRoot":"/","sources":["utilities/group-rider.ts"],"names":[],"mappings":";;AAQA,sDAsBC;AA7BD,iCAAyD;AAOzD,SAAgB,qBAAqB,CACpC,gBAAqF,EACrF,YAA8B;IAE9B,MAAM,aAAa,GAA8B,EAAE,CAAC;IACpD,MAAM,YAAY,GAA8B,EAAE,CAAC;IAEnD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAC/B,gBAAgB;SACd,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,4BAAqB,CAAC,QAAQ,EAAE,4BAAqB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SACjG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAC9B,CAAC;IAEF,KAAK,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,YAAY,EAAE,CAAC;QAE9C,IAAI,CAAC,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YAAE,SAAS;QAG3D,CAAC,QAAQ,KAAK,eAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import { mongoose } from '@typegoose/typegoose';\nimport { Language, RiderAssignmentStatus } from './enum';\nimport { AssignRiderDTO } from './validation';\n\n/**\n * Groups riders by their preferred language (English / Arabic),\n * excluding those who have rejected the assignment.\n */\nexport function groupRidersByLanguage(\n\triderAssignments: { rider: mongoose.Types.ObjectId; status: RiderAssignmentStatus }[],\n\tassignRiders: AssignRiderDTO[]\n) {\n\tconst englishRiders: mongoose.Types.ObjectId[] = [];\n\tconst arabicRiders: mongoose.Types.ObjectId[] = [];\n\n\tconst rejectedRiderIds = new Set(\n\t\triderAssignments\n\t\t\t.filter(a => [RiderAssignmentStatus.REJECTED, RiderAssignmentStatus.CANCELLED].includes(a.status))\n\t\t\t.map(a => a.rider.toString())\n\t);\n\n\tfor (const { _id, language } of assignRiders) {\n\t\t// Skip riders who have rejected\n\t\tif (!_id || rejectedRiderIds.has(_id.toString())) continue;\n\n\t\t// Group by language\n\t\t(language === Language.AR ? arabicRiders : englishRiders).push(_id);\n\t}\n\n\treturn { englishRiders, arabicRiders };\n}\n"]}
|