Skip to content

Support for registering multiple timetables - #24

Merged
mitkz merged 10 commits into
developfrom
copilot/refactor-train-schedule-data
Dec 2, 2025
Merged

mitkz merged 10 commits into
developfrom
copilot/refactor-train-schedule-data

Conversation

Copilot AI commented Dec 2, 2025 •

Copy link
Copy Markdown
Contributor

Refactors the data structure to support an arbitrary number of train schedules instead of a single weekday/holiday pair.

Data Structure

  • TrainScheduleData.mc.example: Replaced weekday_table/holiday_table with schedules array containing objects with title, weekday, and holiday keys
var schedules = [
    {
        "title" => "Commuting - Outbound (Home → Office)",
        "weekday" => [[514,0],[628,1],[655,0]],
        "holiday" => [[614,0],[738,1],[855,0]]
    },
    // ... additional schedules
];

View Updates

  • TrainScheduleFinderView.mc: Added schedule navigation (nextSchedule(), previousSchedule()) and title display

Input Handling

  • TrainScheduleFinderDelegate.mc: New delegate handles swipe up/down to cycle through schedules
  • TrainScheduleFinderApp.mc: Wired delegate to view

Documentation

  • README.md: Updated to reflect new data format
Original prompt

This section details on the original issue you should resolve

<issue_title>Support for registering multiple timetables</issue_title>
<issue_description>Refactor TrainScheduleData.mc.example structure to support storing more than three timetables

example

// Each schedule contains: title, weekday, holiday
// Time entries keep the existing format: [hhmm(int), type(int)]
// type: 0 = local, 1 = express, 2 = special

module TrainScheduleData {
    var schedules = [
        {
            title: "Commuting - Outbound (Home → Office)",
            weekday: [
                [514,0],[628,1],[655,0],[745,1],[815,0],[900,1],[930,0],[1015,1]
            ],
            holiday: [
                [614,0],[738,1],[855,0]
            ]
        },
        {
            title: "Commuting - Inbound (Office → Home)",
            weekday: [
                [1700,0],[1745,1],[1830,0],[1900,1],[2000,0]
            ],
            holiday: [
                [1700,0],[1800,1]
            ]
        },
        {
            title: "Airport Access (Central ↔ Airport)",
            weekday: [
                [500,1],[530,1],[600,1]
            ],
            holiday: [
                [520,1],[620,1]
            ]
        }
    ];
}
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: mitkz <42832770+mitkz@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor TrainScheduleData to support multiple timetables Support for registering multiple timetables Dec 2, 2025
Copilot AI requested a review from mitkz December 2, 2025 03:12
Comment thread source/TrainScheduleData.mc.example
@mitkz
mitkz marked this pull request as ready for review December 2, 2025 05:07
@mitkz
mitkz merged commit dbb4bd9 into develop Dec 2, 2025
1 check failed
@mitkz
mitkz deleted the copilot/refactor-train-schedule-data branch December 2, 2025 05:08
Copilot AI requested a review from mitkz December 2, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants