@@ -98,6 +98,7 @@ $(function() {
98
98
. filter ( bus => bus . attributes . route_name . includes ( 'JT' ) )
99
99
. map ( bus => bus . attributes ) ;
100
100
} else if ( action === 'Mark a bus as arrived or on time' ) {
101
+ < << << << HEAD
101
102
busList = routeList . filter ( bus => ! bus . attributes . route_name . includes ( 'JT' ) )
102
103
. map ( bus => {
103
104
if ( bus . attributes . status === 'a' ) {
@@ -109,6 +110,32 @@ $(function() {
109
110
return bus . attributes ;
110
111
}
111
112
} ) ;
113
+ = === ===
114
+ busList = routeList . map ( bus => {
115
+ if ( ( bus . attributes . status === 'a' || bus . attributes . status === 'd' ) && ! bus . attributes . route_name . includes ( 'JT' ) ) {
116
+ let attr = JSON . parse ( JSON . stringify ( bus . attributes ) ) ;
117
+ attr . route_name = `Mark ${ bus . attributes . route_name } as on time` ;
118
+ return attr ;
119
+ }
120
+ else if ( bus . attributes . status === 'o' ) {
121
+ let attr = JSON . parse ( JSON . stringify ( bus . attributes ) ) ;
122
+ let attr2 = JSON . parse ( JSON . stringify ( bus . attributes ) ) ;
123
+ if ( bus . attributes . route_name . includes ( 'JT' ) ) {
124
+ attr . route_name = `Mark ${ bus . attributes . route_name } as delayed` ;
125
+ return attr ;
126
+ }
127
+ attr . route_name = `Mark ${ bus . attributes . route_name } as delayed` ;
128
+ attr2 . route_name = `Mark ${ bus . attributes . route_name } as arrived` ;
129
+ return [ attr , attr2 ] ;
130
+ } else {
131
+ if ( ! bus . attributes . route_name . includes ( 'JT' ) ) {
132
+ return bus . attributes ;
133
+ }
134
+ return null ;
135
+
136
+ }
137
+ } ) . flat ( ) . filter ( ( element ) => element != null ) ;
138
+ > >>> >>> 45142 c57 ( feat ( bus ) : option to mark bus as delayed )
112
139
} else if ( action === 'Assign a bus to this space' ) {
113
140
busList = routeList . filter ( bus => bus . attributes . status !== 'a' )
114
141
. map ( bus => bus . attributes ) ;
@@ -166,6 +193,7 @@ $(function() {
166
193
} else if ( this . action === 'Mark a bus as arrived or on time' ) {
167
194
let route_name = '' ;
168
195
let st = '' ;
196
+ < << << << HEAD
169
197
// TODO: this is also super hacky
170
198
// Essentially, this checks if the selected route has "Mark"
171
199
// at the beginning, implying that it's to be marked on time.
@@ -174,6 +202,20 @@ $(function() {
174
202
st = 'o' ;
175
203
} else {
176
204
route_name = e . target . value ;
205
+ = === ===
206
+ if ( e . target . value . includes ( 'on' ) ) {
207
+ route_name = e . target . value . split ( ' ' ) [ 1 ] ;
208
+
209
+ st = 'o' ;
210
+ }
211
+ else if ( e . target . value . includes ( 'delayed' ) ) {
212
+ route_name = e . target . value . split ( ' ' ) [ 1 ] ;
213
+
214
+ st = 'd' ;
215
+ }
216
+ else {
217
+ route_name = e . target . value . split ( ' ' ) [ 1 ] ;
218
+ > >>> >>> 45142 c57 ( feat ( bus ) : option to mark bus as delayed )
177
219
st = 'a' ;
178
220
}
179
221
let route = this . model . findWhere ( { route_name : route_name } ) . attributes ;
0 commit comments