fix: Campaign Message Tab Displays Incorrect Data for "Alternate Days" and "Alternate Weeks (≥2)" Schedules#4741
Conversation
…" and "Alternate Weeks (≥2)" Schedules
There was a problem hiding this comment.
Code Review
This pull request introduces a CampaignFrequency field across the campaign creation, overview, and messaging components, updating the database schema and API payloads to support it. The timeline date generation logic has been refactored to incorporate the campaign's frequency. Feedback on the changes includes importing the missing DEFAULT_FREQUENCY constant and adding optional chaining in useCampaignSetupForm.ts to prevent potential runtime errors, as well as ensuring form.startDate and form.endDate are defined before calling buildFrequencyTimelineDates in campaignCommunicationUtils.ts.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const assignmentFrequency = useMemo( | ||
| () => | ||
| assignmentConfigs[activeAssignmentGradeId]?.frequency ?? | ||
| Object.values(assignmentConfigs)[0]?.frequency ?? | ||
| DEFAULT_FREQUENCY, | ||
| [activeAssignmentGradeId, assignmentConfigs], | ||
| ); |
There was a problem hiding this comment.
The DEFAULT_FREQUENCY constant is used here but it is not imported in this file. Please make sure to import it from ../components/campaignSetup/campaignAssignmentUtils at the top of the file:
import { DEFAULT_FREQUENCY } from '../components/campaignSetup/campaignAssignmentUtils';Additionally, to prevent potential runtime errors if assignmentConfigs is null or undefined, we should use optional chaining and a fallback empty object when calling Object.values.
| const assignmentFrequency = useMemo( | |
| () => | |
| assignmentConfigs[activeAssignmentGradeId]?.frequency ?? | |
| Object.values(assignmentConfigs)[0]?.frequency ?? | |
| DEFAULT_FREQUENCY, | |
| [activeAssignmentGradeId, assignmentConfigs], | |
| ); | |
| const assignmentFrequency = useMemo( | |
| () => | |
| assignmentConfigs?.[activeAssignmentGradeId]?.frequency ?? | |
| Object.values(assignmentConfigs ?? {})[0]?.frequency ?? | |
| DEFAULT_FREQUENCY, | |
| [activeAssignmentGradeId, assignmentConfigs], | |
| ); |
| if (form && frequency) { | ||
| return buildFrequencyTimelineDates(form.startDate, form.endDate, frequency); | ||
| } |
There was a problem hiding this comment.
To prevent potential runtime errors or passing undefined values to buildFrequencyTimelineDates, we should ensure that both form.startDate and form.endDate are defined before calling the function.
| if (form && frequency) { | |
| return buildFrequencyTimelineDates(form.startDate, form.endDate, frequency); | |
| } | |
| if (form?.startDate && form?.endDate && frequency) { | |
| return buildFrequencyTimelineDates(form.startDate, form.endDate, frequency); | |
| } |
…" and "Alternate Weeks (≥2)" Schedules
No description provided.