Changes
This commit is contained in:
commit
43842eaabd
|
|
@ -20,6 +20,7 @@ import {
|
|||
weekdayOf,
|
||||
} from './schedule.js';
|
||||
import { getAppSettings } from './settings.js';
|
||||
import { toDmy } from './whatsappFormat.js';
|
||||
import { toCohortSessionDto } from '../utils/serialize.js';
|
||||
|
||||
const LIVE_STATUSES = ['confirmed', 'active'];
|
||||
|
|
@ -441,7 +442,8 @@ export async function pushSession(session, reason, { notifyAdmins = false } = {}
|
|||
const { notifyGroupSessionChange } = await import('./whatsapp.js');
|
||||
await notifyGroupSessionChange(
|
||||
cohort._id,
|
||||
`The ${fromDate} session for ${cohort.name} was ${reason || 'cancelled'}. The next session will be on the next meeting day.`,
|
||||
// `The ${fromDate} session for ${cohort.name} was ${reason || 'cancelled'}. The next session will be on the next meeting day.`,
|
||||
`The ${toDmy(fromDate)} session for ${cohort.name} was ${reason || 'cancelled'}. The next session will be on the next meeting day.`,
|
||||
);
|
||||
return { cancelled: session, appended: null };
|
||||
}
|
||||
|
|
@ -508,7 +510,8 @@ export async function shiftApprovedLeaveSessions(prtId, startYmd, endYmd) {
|
|||
const { notifyGroupSessionChange } = await import('./whatsapp.js');
|
||||
await notifyGroupSessionChange(
|
||||
cohort._id,
|
||||
`The ${fromDate} session for ${cohort.name} was Approved PRT leave. The replacement date is ${toDate}.`,
|
||||
// `The ${fromDate} session for ${cohort.name} was Approved PRT leave. The replacement date is ${toDate}.`,
|
||||
`The ${toDmy(fromDate)} session for ${cohort.name} was Approved PRT leave. The replacement date is ${toDmy(toDate)}.`,
|
||||
);
|
||||
shifted.push({ cohortId: String(cohort._id), fromDate, toDate });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {
|
|||
reminderFireAt,
|
||||
renderTemplate,
|
||||
templateBody,
|
||||
toDmy,
|
||||
toWhatsappDigits,
|
||||
} from './whatsappFormat.js';
|
||||
|
||||
|
|
@ -125,7 +126,8 @@ function sessionVars(session, cohort, { name = '' } = {}) {
|
|||
return {
|
||||
name: firstName(name),
|
||||
cohort: cohort.name || '',
|
||||
date: session.date || '',
|
||||
// date: session.date || '',
|
||||
date: toDmy(session.date),
|
||||
time: session.slot || startTime || '',
|
||||
meetUrl: session.meetUrl || '',
|
||||
prtName: personName(prt),
|
||||
|
|
|
|||
|
|
@ -35,9 +35,16 @@ export function groupSubject(cohort) {
|
|||
return subject.length <= SUBJECT_LIMIT ? subject : subject.slice(0, SUBJECT_LIMIT).trim();
|
||||
}
|
||||
|
||||
// "2026-11-13" to "13-11-2026" for WhatsApp messages.
|
||||
export function toDmy(ymd) {
|
||||
const [y, m, d] = String(ymd || '').split('-');
|
||||
return y && m && d ? `${d}-${m}-${y}` : String(ymd || '');
|
||||
}
|
||||
|
||||
export function groupDescription(cohort, startYmd = '') {
|
||||
const titled = `${SUBJECT_PREFIX}${String(cohort?.name || '').trim() || 'Cohort'}`;
|
||||
const parts = [titled, cohort?.slot, cohort?.language, startYmd ? `starts ${startYmd}` : '']
|
||||
// const parts = [titled, cohort?.slot, cohort?.language, startYmd ? `starts ${startYmd}` : '']
|
||||
const parts = [titled, cohort?.slot, cohort?.language, startYmd ? `starts ${toDmy(startYmd)}` : '']
|
||||
.map((part) => String(part || '').trim())
|
||||
.filter(Boolean);
|
||||
return parts.join(' · ');
|
||||
|
|
|
|||
Loading…
Reference in New Issue