planarnetwork / dtd2mysql

MySQL / MariaDB import for DTD feeds (fares, timetable and routeing)
30 stars 10 forks source link

"00:00" parsed to public_departure_time parsed from CIF instead of NULL #19

Closed mk-fg closed 7 years ago

mk-fg commented 7 years ago

Seem to be an issue with fix for #16, as reverting 1ee1a61e79d fixes that.

Looks like this in CIF database:

  N26072  250761 N 2017-11-13 2017-11-13 1...... A YRK --:-- 00:35 TB
  N26072  250761 N 2017-11-13 2017-11-13 1...... A THI --:-- 00:00
  N26072  250761 N 2017-11-13 2017-11-13 1...... A NTR 01:06 00:00 D
  N26072  250761 N 2017-11-13 2017-11-13 1...... A DAR 01:20 00:00 D
  N26072  250761 N 2017-11-13 2017-11-13 1...... A DHM 01:38 00:00 D
  N26072  250761 N 2017-11-13 2017-11-13 1...... A NCL 02:08 --:-- TF

(where "--:--" are NULL values)

Instead of this (with 1ee1a61e79d reverted):

  N26072  250761 N 2017-11-13 2017-11-13 1...... A YRK --:-- 00:35 TB
  N26072  250761 N 2017-11-13 2017-11-13 1...... A THI --:-- --:--
  N26072  250761 N 2017-11-13 2017-11-13 1...... A NTR 01:06 --:-- D
  N26072  250761 N 2017-11-13 2017-11-13 1...... A DAR 01:20 --:-- D
  N26072  250761 N 2017-11-13 2017-11-13 1...... A DHM 01:38 --:-- D
  N26072  250761 N 2017-11-13 2017-11-13 1...... A NCL 02:08 --:-- TF

Seem to be due to using 5-char TimeField for all *_time fields, while it's only scheduled_*_time that have that optional "H" marker, not public_*_time ones. Hence nullable/nullChars check on TimeField for public times failing when there's an extra random char being captured from the next sibling field.

Guess some special TimeFieldWithHalfMinute can be introduced for scheduled-time fields instead of extending TimeField everywhere.