Skip to content

Commit

Permalink
feat(bus): option to mark bus as delayed
Browse files Browse the repository at this point in the history
closes #1414
  • Loading branch information
IshanA2007 committed May 14, 2023
1 parent 19ab3a9 commit 45142c5
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions intranet/static/js/bus-afternoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ $(function () {
.filter(bus => bus.attributes.route_name.includes('JT'))
.map(bus => bus.attributes);
} else if (action === 'Mark a bus as arrived or on time') {
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 443647ab (feat(bus): option to mark bus as delayed)
busList = routeList.map(bus => {
if ((bus.attributes.status === 'a' || bus.attributes.status === 'd') && !bus.attributes.route_name.includes('JT')) {
let attr = JSON.parse(JSON.stringify(bus.attributes));
Expand All @@ -127,39 +122,6 @@ $(function () {

}
}).flat().filter((element) => element != null);
=======
<<<<<<< HEAD
=======
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
=======
>>>>>>> 443647ab (feat(bus): option to mark bus as delayed)
busList = routeList.filter(bus => bus.attributes.route_name.includes(''))
.map(bus => {
if (bus.attributes.status === 'a' || bus.attributes.status === 'd') {
// TODO: less hacky deep copy
let attr = JSON.parse(JSON.stringify(bus.attributes));
attr.route_name = `Mark ${bus.attributes.route_name} as on time`;
return attr;
}
//Adds two elements, one for marking delayed one for arrived
//.flat() so that the added array gets convereted to two elements
else if (bus.attributes.status === 'o') {
let attr = JSON.parse(JSON.stringify(bus.attributes));
let attr2 = JSON.parse(JSON.stringify(bus.attributes));
attr.route_name = `Mark ${bus.attributes.route_name} as delayed`;
attr2.route_name = `Mark ${bus.attributes.route_name} as arrived`;
return [attr, attr2]
} else {
return bus.attributes;
}
}).flat();
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
=======
=======
>>>>>>> 443647ab (feat(bus): option to mark bus as delayed)
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
} else if (action === 'Assign a bus to this space') {
busList = routeList.filter(bus => bus.attributes.status !== 'a')
.map(bus => bus.attributes);
Expand Down Expand Up @@ -209,50 +171,18 @@ $(function () {
} else if (this.action === 'Mark a bus as arrived or on time') {
let route_name = '';
let st = '';
<<<<<<< HEAD
if (e.target.value.includes('on')) {
route_name = e.target.value.split(' ')[1];

=======
// TODO: this is also super hacky
// Essentially, this checks if the selected route has "Mark"
// at the beginning, implying that it's to be marked on time.
if (e.target.value.includes('on time')) {
route_name = e.target.value.split(' ')[1];
alert(route_name);
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
=======
=======
>>>>>>> 443647ab (feat(bus): option to mark bus as delayed)
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
st = 'o';
}
else if (e.target.value.includes('delayed')) {
route_name = e.target.value.split(' ')[1];
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 443647ab (feat(bus): option to mark bus as delayed)

st = 'd';
}
else {
route_name = e.target.value.split(' ')[1];
=======
<<<<<<< HEAD
=======
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
=======
>>>>>>> 443647ab (feat(bus): option to mark bus as delayed)
alert(route_name);
st = 'd';
}
else {
route_name = e.target.value;
>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu)
st = 'a';
}
let route = this.model.findWhere({ route_name: route_name }).attributes;
Expand Down

0 comments on commit 45142c5

Please sign in to comment.