WRI-Cities / static-GTFS-manager

GUI interface for creating, editing, exporting of static GTFS data for a public transit authority
GNU General Public License v3.0
147 stars 46 forks source link

Trips and Timings : newly created trip fails to load in timings tab #121

Closed stdevEdu closed 5 years ago

stdevEdu commented 5 years ago

When I try to add a new route, I add each sequences' stops and shapes. When I move to trips, I'm able to create new trips, but when I move to timings, it throws '500: Internal Server Error' when I click load timings.

answerquest commented 5 years ago

Hi @stdevEdu thanks for catching this bug. I recreated your steps, and getting same error, with this console log:

stopTimes GET call
readTableDB: table:trips, column:trip_id, value:"120M001"
readTableDB: Loaded trips, 1 records
lookup for stop_times: stop_times_lookup.json
Found chunk for id 120M001: None
ERROR:tornado.application:Uncaught exception GET /API/stopTimes?trip=120M001&route=120M&direction=0 (::1)
HTTPServerRequest(protocol='http', host='localhost:5000', method='GET', uri='/API/stopTimes?trip=120M001&route=120M&direction=0', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "/mnt/STUFF/py36/lib/python3.6/site-packages/tornado/web.py", line 1590, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "GTFSManager.py", line 514, in get
    stoptimesArray = stoptimesDf.to_dict(orient='records')
UnboundLocalError: local variable 'stoptimesDf' referenced before assignment
ERROR:tornado.access:500 GET /API/stopTimes?trip=120M001&route=120M&direction=0 (::1) 148.69ms

(please keep in mind to always share console output, helps better to track down error)

The program is not handling new trip right now. What it needs to do is:

I'll get back on this in some days, or if you want you could try taking a whack at the code. I'll admit its a little complicated and the code documentation from my side has a lot of work to do.

I want to know how people are using this tool. If its ok, can you share your use case and OS?

answerquest commented 5 years ago

@stdevEdu I figured out the problem. A case of "Lost in ifs and elses". And there was already provision to load template stops sequence for new trip, just on the python side there was some legacy code causing problem. Will push the updated code soon. Thanks for pointing out this bug.

stdevEdu commented 5 years ago

Worked just fine! Thank you!

answerquest commented 5 years ago

@stdevEdu glad to know. Now, a request: I want to know how people are using this tool. If its ok, can you share your use case and OS? You can send me email on nikhil.js [at] gmail.com .