Skip to content

Commit

Permalink
bug fix on MOTP-2144
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldonabrown committed Jun 10, 2024
1 parent 68242f6 commit eece7bb
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,16 @@ public DuplicateState(GtfsMutableRelationalDao dao, String calendarAgencyId) {
this.dao = dao;
this.calendarAgencyId = calendarAgencyId;
String largestServiceId = Collections.max(dao.getAllCalendarDates().stream().map(l->l.getServiceId().getId()).collect(Collectors.toSet()));
// here we make an assumption that service ids are numeric
serviceIdCounter = Integer.parseInt(largestServiceId) + 1;
// remove any de-duplication prefix from the service id
largestServiceId = largestServiceId.replaceAll("^[a-z]-", "");
try {
// here we make an assumption that service ids are numeric
serviceIdCounter = Integer.parseInt(largestServiceId) + 1;
} catch (NumberFormatException e) {
// we guessed wrong, we have some string service ids
// create a higher order service_id that should not conflict
serviceIdCounter = 10000;
}
}

public void addTrip(Trip exemplar, Set<AgencyAndId> serviceIds) {
Expand Down

0 comments on commit eece7bb

Please sign in to comment.