Skip to content

Commit 437be4e

Browse files
authored
fix(meetings): handle string recurrence values from v1 meetings (#194)
* fix(meetings): handle string recurrence values from v1 meetings In v1 meetings, recurrence pattern fields like type, monthly_week, and monthly_week_day are returned as strings instead of integers. This caused strict equality comparisons to fail. Added parseToInt() helper to handle both string and number inputs, and updated convertToRecurrencePattern() to parse all numeric fields before use. LFXV2-865 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Asitha de Silva <asithade@gmail.com> * fix(ui): fix height of meeting card non invited v1 meeting Signed-off-by: Asitha de Silva <asithade@gmail.com> * fix(meetings): handle string recurrence values from v1 meetings In v1 meetings, recurrence pattern fields like type, monthly_week, and monthly_week_day are returned as strings instead of integers. This caused strict equality comparisons to fail. Added parseToInt() helper to handle both string and number inputs, and updated convertToRecurrencePattern() to parse all numeric fields before use. Also added handling for one-time meetings (end_times=1) to display "One-time meeting" instead of "Daily, for 1 occurrence". LFXV2-865 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Asitha de Silva <asithade@gmail.com> * fix(meetings): use explicit undefined checks for monthlyType Fix monthlyType determination to use explicit undefined checks instead of truthiness to handle 0 values correctly (0 is a valid day-of-week value for Sunday). LFXV2-865 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Asitha de Silva <asithade@gmail.com> --------- Signed-off-by: Asitha de Silva <asithade@gmail.com>
1 parent 3e44a7b commit 437be4e

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed

apps/lfx-one/src/app/modules/meetings/components/meeting-card/meeting-card.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ <h3 class="text-base font-medium text-gray-900 leading-tight tracking-tight" dat
292292
(click)="registerForMeeting()">
293293
</lfx-button>
294294
</div>
295+
} @else {
296+
<div class="h-full flex items-center justify-center"></div>
295297
}
296298
} @else if (pastMeeting() && !meeting().organizer) {
297299
<!-- Show Recording and AI Summary buttons for past meetings (non-organizers) -->

apps/lfx-one/src/app/shared/pipes/recurrence-summary.pipe.ts

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,34 @@ export class RecurrenceSummaryPipe implements PipeTransform {
2929
}
3030

3131
private convertToRecurrencePattern(recurrence: MeetingRecurrence): CustomRecurrencePattern {
32+
// Parse numeric values that might come as strings from v1 meetings
33+
// type defaults to 2 (weekly), repeat_interval defaults to 1
34+
const type = this.parseToInt(recurrence.type) ?? 2;
35+
const monthlyDay = this.parseToInt(recurrence.monthly_day);
36+
const monthlyWeek = this.parseToInt(recurrence.monthly_week);
37+
const monthlyWeekDay = this.parseToInt(recurrence.monthly_week_day);
38+
const endTimes = this.parseToInt(recurrence.end_times);
39+
const repeatInterval = this.parseToInt(recurrence.repeat_interval) ?? 1;
40+
3241
// Determine pattern type from recurrence.type
3342
let patternType: 'daily' | 'weekly' | 'monthly' = 'weekly';
34-
if (recurrence.type === 1) patternType = 'daily';
35-
else if (recurrence.type === 2) patternType = 'weekly';
36-
else if (recurrence.type === 3) patternType = 'monthly';
43+
if (type === 1) patternType = 'daily';
44+
else if (type === 2) patternType = 'weekly';
45+
else if (type === 3) patternType = 'monthly';
3746

3847
// Determine monthly type
48+
// Use explicit undefined checks to handle 0 values correctly (0 is a valid day-of-week for Sunday)
3949
let monthlyType: 'dayOfMonth' | 'dayOfWeek' = 'dayOfMonth';
40-
if (recurrence.monthly_day) {
50+
if (monthlyDay !== undefined) {
4151
monthlyType = 'dayOfMonth';
42-
} else if (recurrence.monthly_week && recurrence.monthly_week_day) {
52+
} else if (monthlyWeek !== undefined && monthlyWeekDay !== undefined) {
4353
monthlyType = 'dayOfWeek';
4454
}
4555

4656
// Determine end type
4757
let endType: 'never' | 'date' | 'occurrences' = 'never';
4858
if (recurrence.end_date_time) endType = 'date';
49-
else if (recurrence.end_times) endType = 'occurrences';
59+
else if (endTimes) endType = 'occurrences';
5060

5161
// Convert weekly_days to array if present
5262
let weeklyDaysArray: number[] = [];
@@ -56,10 +66,31 @@ export class RecurrenceSummaryPipe implements PipeTransform {
5666

5767
return {
5868
...recurrence,
69+
type,
70+
monthly_day: monthlyDay,
71+
monthly_week: monthlyWeek,
72+
monthly_week_day: monthlyWeekDay,
73+
end_times: endTimes,
74+
repeat_interval: repeatInterval,
5975
patternType,
6076
monthlyType,
6177
endType,
6278
weeklyDaysArray,
6379
};
6480
}
81+
82+
/**
83+
* Parse a value to integer, handling both string and number inputs.
84+
* Returns undefined if the value is undefined, null, or cannot be parsed.
85+
*/
86+
private parseToInt(value: string | number | undefined | null): number | undefined {
87+
if (value === undefined || value === null) {
88+
return undefined;
89+
}
90+
if (typeof value === 'number') {
91+
return value;
92+
}
93+
const parsed = parseInt(value, 10);
94+
return isNaN(parsed) ? undefined : parsed;
95+
}
6596
}

packages/shared/src/utils/meeting.utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ export function buildRecurrenceSummary(pattern: CustomRecurrencePattern): Recurr
5252
};
5353
}
5454

55+
// A meeting with end_times of 1 is essentially a one-time meeting
56+
if (pattern.end_times === 1) {
57+
return {
58+
description: 'One-time meeting',
59+
endDescription: '',
60+
fullSummary: 'One-time meeting',
61+
};
62+
}
63+
5564
let description = '';
5665
let endDescription = '';
5766

0 commit comments

Comments
 (0)