Skip to content

Commit

Permalink
Change default behaviour: set the default value of removeToday to fal…
Browse files Browse the repository at this point in the history
…se in the remove old calendar statements operation
  • Loading branch information
SeifGhz committed Dec 6, 2024
1 parent 907653a commit 3b0bf35
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/onebusaway-gtfs-transformer-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,17 @@ those manually.

RemoveOldCalendarStatements is an operation designed to remove calendar entries that are no longer valid on today's date.

By default, it deletes entries from the calendar.txt file whose end_date field has passed, including those valid until today.
By default, it deletes entries from the calendar.txt file whose end_date field has passed.

With the remove_today attribute added to the JSON transformer snippet, users can control whether calendar entries valid for today are included or excluded in the output GTFS.

* If remove_today is set to true or not specified, the transformer will remove the calendar entries for the current date.
* If remove_today is set to true, the transformer will remove the calendar entries for the current date.

```
{"op":"transform", "class":"org.onebusaway.gtfs_transformer.impl.RemoveOldCalendarStatements", "remove_today":true}
```

* If remove_today is set to false, the transformer will retain the calendar entries for the current date.
* If remove_today is set to false or not specified, the transformer will retain the calendar entries for the current date.

```
{"op":"transform", "class":"org.onebusaway.gtfs_transformer.impl.RemoveOldCalendarStatements", "remove_today":false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
/**
* Remove calendar dates that are past.
*
* remove_today: delete today's calendar dates if true. Default value is true
* remove_today: delete today's calendar dates if true. Default value is false
*/
public class RemoveOldCalendarStatements implements GtfsTransformStrategy {
@CsvField(optional = true)
private boolean removeToday = true;
private boolean removeToday = false;

@CsvField(ignore = true)
private CalendarFunctions helper = new CalendarFunctions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testRemoveCalendarForToday() throws IOException {
@Test
public void testRemoveCalendar() throws IOException {
GtfsMutableRelationalDao dao = _gtfs.read();
removeOldCalendarStatements.setRemoveToday(false);
// Keep the default value as false and do not change it
removeOldCalendarStatements.run(_context, dao);
// Verify that GtfsMutableRelationalDao object still contain the initially added calendar entry
assertEquals(1,dao.getAllCalendars().size());
Expand Down

0 comments on commit 3b0bf35

Please sign in to comment.