pandajake / transitdatafeeder

Automatically exported from code.google.com/p/transitdatafeeder
0 stars 0 forks source link

Transaction failure for adding trip #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Log in
2. Add stops
3. Add routes
4. Add Trip; and trips details; click "Save"

What is the expected output? What do you see instead?
Should add the trip and return to list of trips. Instead, it throws an error 
trace (when looking at the database, though, the trip is added). It cannot show 
the trip, since it cannot find the trip's start time.

Please provide any additional information below.

This solved the problem for us (South Africa): on line 261 in 
/datafeeder/src/main/org/ideaproject/model/Trip.java in the function 
getFirstStop() the code checks if stopTimes has any entries
        public StopTime getFirstStop() {
                return (stopTimes != null && !stopTimes.isEmpty()) ? stopTimes.get(0) : null;
        }

this unfortunately does not happen on line 298 in function getFirstStopTime()

change the code to

        public Date getFirstStopTime() {
                if (basedOn != null) {
                        return tripStartTime;
                } else if (stopTimes != null && !stopTimes.isEmpty()){
                        return stopTimes.get(0).getArrivalTime();
                }
                return new Date(0);
        }

and it should work.

Original issue reported on code.google.com by johanwjo...@gmail.com on 13 May 2011 at 10:27

GoogleCodeExporter commented 8 years ago
I made the changes and committed.

Original comment by johanwjo...@gmail.com on 13 Jul 2011 at 9:05