Skip to content

[Bug-Schedule-Builder-Duplicate-Saved-Schedules]: Validate whether a duplicate schedule is being savedΒ #220

@Castro19

Description

@Castro19

🐞 Bug Description

When saving a schedule in the Schedule Builder, there is no indication that the schedule has been successfully saved. Additionally, users can save the same schedule multiple times without any restrictions.

βœ… Steps to Reproduce

  1. Navigate to the Schedule Builder.
  2. Create a schedule and save it.
  3. Observe that there is no feedback confirming the save action.
  4. Attempt to save the same schedule again.
  5. Notice that the schedule is saved multiple times without any validation.

πŸ” Expected Behavior

  • The UI should provide feedback (e.g., a success message or visual indication) when a schedule is saved.
  • The system should prevent duplicate schedule saves by checking for existing schedules with the same class numbers.

πŸ–₯️ System Information

  • OS: [Specify OS]
  • Browser: [Specify Browser]
  • PolyLink Version: [Specify Version]

πŸ“Έ Screenshots (If applicable)

Add screenshots if available.

πŸ“Œ Acceptance Criteria

  • βœ… Display a confirmation message or UI feedback when a schedule is saved.
  • βœ… Prevent duplicate schedule saves by comparing class numbers.
  • βœ… Fix should prevent future occurrences.
  • βœ… Should be tested in different environments.

πŸ”§ Technical Notes

  • Modify the frontend logic where we dispatch the action to create or update a calendar:
  • Update the Redux async thunk that calls the CRUD function for creating/updating calendars:
    • [GitHub Permalink](
      export async function createOrUpdateCalendar(
      sections: SelectedSection[]
      ): Promise<{
      calendars: CalendarListItem[];
      primaryCalendarId: string;
      }> {
      try {
      const response = await fetch(`${serverUrl}/calendars`, {
      method: "POST",
      body: JSON.stringify({ sections }),
      headers: {
      "Content-Type": "application/json",
      },
      credentials: "include",
      });
      const data = await response.json();
      return data;
      } catch (error) {
      console.error("Error creating or updating calendar:", error);
      throw error;
      }
      }
      )
  • Implement backend validation in calendarListServices.ts to check for duplicate schedules before inserting:
    • File Path: server/src/db/models/calendar/calendarListServices.ts

πŸ“Ž Related Issues

  • Depends on #XX
  • Related to #XX

This should help your team track and resolve the issue efficiently! Let me know if you need adjustments. πŸš€

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions