diff --git a/pages/api/schedule.ts b/pages/api/schedule.ts index a200b79..d95b1e6 100644 --- a/pages/api/schedule.ts +++ b/pages/api/schedule.ts @@ -140,7 +140,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) if (shift.assignments.some(a => a.isWithTransport)) { if (shift.requiresTransport) { notes = "Транспорт: "; - notes_bold = " " + shift.assignments.filter(a => a.isWithTransport).map(a => a.publisher.firstName.charAt(0) + "." + a.publisher.lastName.charAt(0) + ".").join(", "); + notes_bold = " " + shift.assignments.filter(a => a.isWithTransport).map(a => common.getInitials(a.publisher.firstName + " " + a.publisher.lastName)).join(", "); } } diff --git a/src/helpers/common.js b/src/helpers/common.js index 8cbf543..615dfcb 100644 --- a/src/helpers/common.js +++ b/src/helpers/common.js @@ -746,3 +746,8 @@ exports.getLocalStorage = function (key, defaultValue) { exports.root = function (req) { return process.env.NEXT_PUBLIC_PUBLIC_URL; } + +exports.getInitials = function (names) { + const parts = names.split(' '); + return parts.map(part => part[0] + ".").join(''); +} \ No newline at end of file