Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
kpwebb committed May 8, 2015
2 parents a553ea6 + 0641b72 commit fd51a3a
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
10 changes: 6 additions & 4 deletions app/datastore/AgencyTx.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,14 @@ public LocalDate[] run(String id, ScheduleException ex) {
});

tripCountByCalendar = getMap("tripCountByCalendar");
Bind.histogram(trips, tripCountByCalendar, new Fun.Function2<String, String, Trip>() {
BindUtils.multiHistogram(trips, tripCountByCalendar, new Fun.Function2<String[], String, Trip>() {

@Override
public String run(String key, Trip trip) {
// TODO Auto-generated method stub
return trip.calendarId;
public String[] run(String key, Trip trip) {
if (trip.calendarId == null)
return new String[] {};
else
return new String[] { trip.calendarId };
}
});

Expand Down
2 changes: 2 additions & 0 deletions app/models/transit/TripPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public class TripPattern extends Model implements Cloneable, Serializable {
// if true, use straight-line rather than shape-based distances
public boolean useStraightLineDistances;

public boolean useFrequency;

public String routeId;

public String agencyId;
Expand Down
4 changes: 2 additions & 2 deletions app/views/Admin/accounts.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</script>

<script id="resetPassword" type="text/html">
<form method="POST" id="resetPasswordForm" action="@{Admin.changePassword()}" class="form-horizontal">
<form method="POST" id="resetPasswordForm" action="@{Admin.resetPassword()}" class="form-horizontal">
<div class="control-group">
<label class="control-label" for="username">Username</label>
<div class="controls">
Expand Down Expand Up @@ -157,7 +157,7 @@ <h3>Account Management</h3>
<td>#{if account.lastLogin}${account.lastLogin.format('yyyy-MM-dd hh:mm')}#{/if}#{else}--#{/else}</td>
<td>#{if account.active}<i class="icon-ok"></i>#{/if}#{else}<i class="icon-remove"></i>#{/else}</td>
<td>#{if account.admin}<i class="icon-ok"></i>#{/if}#{else}<i class="icon-remove"></i>#{/else}</td>
<td>#{if account.agency}${account.agency.name}#{/if}</td>
<td>#{if account.agencyId}${account.agencyId}#{/if}</td>
<td><a href="#editAccountModal" onclick="editAccount('${account.username}');">Edit</a> <!-- | <a href="#resetPasswordModal" onclick="resetPassword('${account.username}');">Reset Password</a> --></td>

</tr>
Expand Down
4 changes: 2 additions & 2 deletions app/views/Application/route.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ <h3 id="calendar-create-modal-label">&{'route.trip-info-tpl.calendar-create-moda
<label class="control-label" for="tripPattern"><strong>&{'route.trip-info-tpl.trip-pattern'}</strong><br>(&{'shared.required'})</label>
<div class="controls">
<p>
<select required name="pattern" id="tripPattern" class="input" title="&{'route.trip-info-tpl.trip-pattern'}" data-content="&{'route.trip-info-tpl.trip-pattern-content'}">
<select required name="patternId" id="tripPattern" class="input" title="&{'route.trip-info-tpl.trip-pattern'}" data-content="&{'route.trip-info-tpl.trip-pattern-content'}">
<option value="">-- &{'route.trip-pattern-select-pattern'} --</option>

{{#items}}<option value="{{attributes.id}}">{{attributes.name}}</option>{{/items}}
Expand Down Expand Up @@ -344,7 +344,7 @@ <h3 id="calendar-create-modal-label">&{'route.trip-info-tpl.calendar-create-moda
<label class="control-label" for="trip"><strong>&{'route.trip-info-tpl.trip'}</strong><br>(&{'shared.required'})</label>
<div class="controls">
<p>
<select required name="pattern" id="trip" class="input" title="&{'route.trip-info-tpl.trip'}" data-content="&{'route.trip-info-tpl.trip-content'}">
<select required name="patternId" id="trip" class="input" title="&{'route.trip-info-tpl.trip'}" data-content="&{'route.trip-info-tpl.trip-content'}">
<option value="">-- &{'route.trip-pattern-select-trip'} --</option>

{{#items}}<option value="{{attributes.id}}">{{attributes.tripDescription}}</option>{{/items}}
Expand Down
6 changes: 3 additions & 3 deletions conf/application.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ date.format=yyyy-MM-dd
# db=mysql://user:pwd@host/database
#
# To connect to a local PostgreSQL9 database, use:
db.url=jdbc:postgresql://127.0.0.1/gtfs-editor
db.driver=org.postgresql.Driver
db.user=postgres
# db.url=jdbc:postgresql://127.0.0.1/gtfs-editor
# db.driver=org.postgresql.Driver
# db.user=postgres
#
# If you need a full JDBC configuration use the following :
# db.url=jdbc:postgresql:database_name
Expand Down
2 changes: 1 addition & 1 deletion conf/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require:
- org.geotools -> gt-geojson 12.2
- com.fasterxml.jackson.core -> jackson-core 2.4.4
- com.fasterxml.jackson.core -> jackson-databind 2.4.4
- org.opentripplanner -> otp 1.0.0-SNAPSHOT
- org.opentripplanner -> otp 0.14.0
- net.sf.opencsv -> opencsv 2.0
- org.mapdb -> mapdb 1.0.7

Expand Down
23 changes: 19 additions & 4 deletions public/javascripts/views/trip-info-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ var GtfsEditor = GtfsEditor || {};

var data = G.Utils.serializeForm($(evt.target));

data.serviceCalendar = data.frequencyServiceCalendar;
data.calendarId = data.frequencyServiceCalendar;

data = _.omit(data, ['file', 'scheduleType', 'frequencyServiceCalendar', 'timetableServiceCalendar']);

data.pattern = selectedPatternId;
data.patternId = selectedPatternId;
data.startTime = this.calcTime(data.startTimeString);
data.endTime = this.calcTime(data.endTimeString);
data.headway = this.calcTime(data.serviceFrequencyString);
data.routeId = this.model.tripPatterns.get(selectedPatternId).get('routeId');

delete data.startTimeString;
delete data.endTimeString;
Expand Down Expand Up @@ -198,10 +199,24 @@ var GtfsEditor = GtfsEditor || {};

var tripData = {
useFrequency: true,
pattern: selectedPatternId,
patternId: selectedPatternId,
agencyId: G.session.agencyId,
tripDescription: this.$('[name=name]').val()
};

var arrivalTime = 0, departureTime = 0;

tripData.stopTimes = _.map(this.model.tripPatterns.get(selectedPatternId).get('patternStops'), function (ps) {
arrivalTime = departureTime + ps.defaultTravelTime;
departureTime = arrivalTime + ps.defaultDwellTime;

return {
stopId: ps.stopId,
arrivalTime: arrivalTime,
departureTime: departureTime
};
});

var view = this;

this.model.tripPatterns.get(selectedPatternId).trips.create(tripData, {
Expand Down Expand Up @@ -237,7 +252,7 @@ var GtfsEditor = GtfsEditor || {};

var tripData = {
useFrequency: true,
pattern: selectedPatternId,
patternId: selectedPatternId,
tripDescription: this.$('[name=name]').val(),
serviceCalendar: serviceCalendarId,
startTime: existingTrip.startTime,
Expand Down

0 comments on commit fd51a3a

Please sign in to comment.