Open mharvey opened 6 years ago
I'd rather not make auto-naming any more complex than it already is, but that's probably the right thing for these horrible feeds. It may make sense to move this to a suggest_name
function on the Feed
model, so that we can get it under unit tests and code coverage, rather than import a whole feed to test it.
I like the idea of a suggest_name
function. I'd be happy to take a stab at knocking this out over the next week or so if you want.
Thanks @mharvey I'd appreciate a PR
When importing a feed with a
calendar_dates.txt
(The "TriMet Style") with the management command, the import fails with a nasty error when it tries to rename the feed at the very end. The rest of the import seems to work flawlessly.When providing a name via the
-n
switch, the name generation is skipped and the error is avoided.It appears that the
Service
objects are being created, but withService.start_date
andService.end_date
both nulled. When the importer gets to this parthttps://github.com/tulsawebdevs/django-multi-gtfs/blob/f104c09424f9c6b2557db6ef08f40893ee4ea2ed/multigtfs/management/commands/importgtfs.py#L84-L92
the
service
exists, butservice.start_date
isNone
which causes thestrftime
to puke out this error:I think the better behavior would be to check for an existing
FeedInfo
and use the start/end dates from that, then fall back toService
, and if thestart_date
isNone
or theService
doesn't exist, then finally fall back to the default name with the date on which the feed was imported.