summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnson Bridges <bridges.anson@gmail.com>2024-11-15 18:54:26 -0500
committerAnson Bridges <bridges.anson@gmail.com>2024-11-15 18:54:26 -0500
commit59193deb22954fa8e86708be1b90c78282e829dc (patch)
treef822e74fcdf322757b80de09419edf85c2a3952a
parent3f68ac783948c7d47974993854a1d317399d3b04 (diff)
final setup for hunt
-rw-r--r--dashboard_website/__pycache__/db.cpython-312.pycbin13656 -> 13912 bytes
-rw-r--r--dashboard_website/__pycache__/router.cpython-312.pycbin19073 -> 22228 bytes
-rw-r--r--dashboard_website/dashboard.py6
-rw-r--r--dashboard_website/db.py17
-rw-r--r--dashboard_website/dirt.csv249
-rw-r--r--dashboard_website/router.py140
-rw-r--r--dashboard_website/savefile.csv58
-rw-r--r--dashboard_website/static/js/dashboard.js43
-rw-r--r--dashboard_website/templates/index.html11
9 files changed, 363 insertions, 161 deletions
diff --git a/dashboard_website/__pycache__/db.cpython-312.pyc b/dashboard_website/__pycache__/db.cpython-312.pyc
index b5db03b..d281091 100644
--- a/dashboard_website/__pycache__/db.cpython-312.pyc
+++ b/dashboard_website/__pycache__/db.cpython-312.pyc
Binary files differ
diff --git a/dashboard_website/__pycache__/router.cpython-312.pyc b/dashboard_website/__pycache__/router.cpython-312.pyc
index 3c20b6e..cf58209 100644
--- a/dashboard_website/__pycache__/router.cpython-312.pyc
+++ b/dashboard_website/__pycache__/router.cpython-312.pyc
Binary files differ
diff --git a/dashboard_website/dashboard.py b/dashboard_website/dashboard.py
index 757324d..15a019f 100644
--- a/dashboard_website/dashboard.py
+++ b/dashboard_website/dashboard.py
@@ -260,7 +260,8 @@ def getLatestInfo():
'home_changed' : False,
'routes_changed' : False,
'routes_to_commit' : db.routesToCommit,
- 'route_update_staged' : db.is_route_update_required() }
+ 'route_update_staged' : db.is_route_update_required(),
+ 'minimal_routing' : db.minimalRouting}
cl = db.getCluesJSON(last_timestamp)
if cl != False:
data['clues_changed'] = True
@@ -340,6 +341,9 @@ def siteControls():
if db.routesToCommit:
db.applyPreviewRoutes()
return jsonify({"status" : "OK"})
+ elif cmd == "toggleMinimal":
+ db.toggleMinimalRouting()
+ return jsonify({"status" : "OK"})
return render_template("controls.html")
diff --git a/dashboard_website/db.py b/dashboard_website/db.py
index 6142fed..f49732e 100644
--- a/dashboard_website/db.py
+++ b/dashboard_website/db.py
@@ -26,7 +26,7 @@ home_last_changed = time.time()
routes_last_changed = time.time()
route_update_required = False
currently_updating = False
-minimalRouting = False # if false, currently assigned clues
+minimalRouting = True # if false, currently assigned clues
routesToCommit = False # if there exist preview routes to commit
_bikes_changed = False # In case bikes or clues are enabled/disabled
@@ -52,6 +52,10 @@ def force_stop():
def is_route_update_required():
return route_update_required
+def toggleMinimalRouting():
+ global minimalRouting
+ minimalRouting = not minimalRouting
+
# called every time a node is added
# a bike is added/removed
# determines/assigns clusters, and assigns routes to bikes
@@ -288,7 +292,7 @@ def visitClueTeam(team_index, clue_name):
# otherwise
c.visit()
clues_last_changed = time.time()
- route_update_required
+ route_update_required = True
def load(filename=None):
@@ -317,8 +321,9 @@ def load(filename=None):
longitude = float(row[2])
info = row[3]
status = row[4]
+ reqd = True if (row[5] == "True") else False
- clues.append(Clue(latitude, longitude, name, info, status))
+ clues.append(Clue(latitude, longitude, name, info, status, required=reqd))
except:
return 1
clues_last_changed = time.time()
@@ -361,12 +366,12 @@ def save():
with open("savefile.csv", 'w', newline='') as f:
csvwriter = csv.writer(f, delimiter=',', quotechar='"')
# add a header row
- csvwriter.writerow(["name", "latitude", "longitude", "info", "status"])
+ csvwriter.writerow(["name", "latitude", "longitude", "info", "status", "required"])
for clue in clues:
- csvwriter.writerow([clue.name, clue.latitude, clue.longitude, clue.info, clue.status])
+ csvwriter.writerow([clue.name, clue.latitude, clue.longitude, clue.info, clue.status, clue.required])
bikes = [ Bike(homeBase.latitude, homeBase.longitude, "Team 1"),
Bike(homeBase.latitude, homeBase.longitude, "Team 2"),
Bike(homeBase.latitude, homeBase.longitude, "Team 3"),
Bike(homeBase.latitude, homeBase.longitude, "Team 4") ]
-#load("all_clues.csv") \ No newline at end of file
+#load() \ No newline at end of file
diff --git a/dashboard_website/dirt.csv b/dashboard_website/dirt.csv
index 08ab5cd..217b086 100644
--- a/dashboard_website/dirt.csv
+++ b/dashboard_website/dirt.csv
@@ -1,68 +1,193 @@
-Clue ID,Clue,Name,"Latitude, Longitude (right click near place on google maps, then click the coordinates to copy)",,
-A1,"1) Where Andrew, Tom, and Toby might toss a frisbee PETERS PARK BOSTON",Peters Park,"42.3430402738135, -71.0675801105357",,
-A2,2) It's not North of Washington Street.... SOWA → South of Washington Street?,SoWa Market(?),,,
-A3,"3) Blues, Latin jazz salsa, jazz xa, funk x3, 24/7/365 Wally’s Cafe Jazz club",Wally's Cafe Jazz Club,"42.340735169280684, -71.0822142949978",,
-A4,"4) Not to be confused with the Jesuit college in Worcester, this is a cathedral Cathedral",Cathedral of the Holy Cross,"42.340965725249276, -71.07004200293923",,
-A5,5) Lilli Ann K Rosenberg brainchild in the South End,Betances Mural (80%),"42.34236478201366, -71.07314991031272",,
-A6,"6) Not an above-ground railroad, she is remembered as one of the conductors",Harriet Tubman Memorial,"42.34355826498339, -71.0779098454636",,
-A7,7) Halloween's Michael + Community's Señor: ,Myers+Chang,"42.343917124461065, -71.06620549483627",,
-A8,8) This diner has a secret,Hidden Kitchen,"42.33836232114676, -71.0667887997758",,
-A9,9) Need budgeting advice? Take a page out of their book,,,,
-A10,"10) Go for the Spanish dancing, stay for the Spanish food",La Fabrica Central Restaurant,"42.363845469421676, -71.10129788828729",,
-A11,11) A place Petunia and Vernon would love to share a cup of coffee,"Dudley Cafe , Dudley Square","42.33000580911709, -71.08345739566941",,
-A12,12) The namesake of this house suggested bullets or ballots,Malcolm X House,"42.321503645221576, -71.0863561083245",,
-A13,13) A station honoring an ancient Nile kingdom → ,"Nubian Station, Roxbury","42.329719158213535, -71.08393017974034",,
-A14,"14) The sun, but in French.",soleil,"42.32995937830152, -71.08425706494715",,
-A15,15) Taking down bear proof cages is a lot harder than putting them up,old bear pens,"42.31163492909362, -71.0944883387719",,
-A16,"16) A high school for mayo, smoked turkey, cucumbers, tomatoes, and sprouts",,,,
-A17,17) Where to go when you need spaghetti in a hurry on the hill,Lily's Gourmet Pasta Express,"42.33240052352865, -71.10001875238213",,
-A18,18) The Jamaica Plain Tuesday Club is its steward,Loring Greenough House,"42.30940190779075, -71.11503165360074",,
-A19,19) Spooner finds 2020 chicago mayor at this theater (9 letters),Strand Theatre,"42.31599303331773, -71.0660247",,
-A20,"20) You won't find cows or pigs in this barn, but maybe a hot meal instead",noodle barn (?),"42.31145648101414, -71.11454193944768",,
-A21,21) The Crimson's green showcase,Harvard Arboretum,"42.30758360954152, -71.11986574437587",,
-A22,22) A not so functional seat to enjoy pond views,JAMACIA POND BENCH,"42.31703238067602, -71.1172176327592",,
-A23,"23) Grab a book from this famous labor organizer, it's plainly not a Haymarket affair",Lucy Parsons Center (Jamaica Plain),"42.32234399461923, -71.10765946762163",,
-A24,24) Go to this fire station to get an ice cold treat,fire station turned JP Licks,"42.312828161837565, -71.1142521044243",,
-A25,"25) Sorta like the death of an author, but (mil)more in bronze",Death and the Sculptor,,,"42.29783644453621, -71.10768546216663"
-A26,26) SD.2702 was recently passed here,Massachusetts State House,"42.35772690789592, -71.0636244852727",,
-A27,"27) Mae's performing here either today or tomorrow -> 158 Brighton Ave, Allston, MA 02134",Brighton Music Hall,"42.35296368437526, -71.13261242438084",,
-A28,"28) I don't know much about their baked goods, but the flag is a big plus",SWISS BAKERY ALSTON,"42.3632259246665, -71.12855843461686",,
-A29,"29) If you're looking for good Asian fusion, you'll find a bonch on Brighton Avenue",Bonchon Boston,"42.35298420423782, -71.13089261430888",,
+Clue ID,Clue,Name,"Latitude, Longitude (right click near place on google maps, then click the coordinates to copy)",,
+A1,"1) Where Andrew, Tom, and Toby might toss a frisbee PETERS PARK BOSTON",Peters Park,"42.3430402738135, -71.0675801105357",,
+A2,2) It's not North of Washington Street.... SOWA → South of Washington Street?,SoWa Market(?),,,
+A3,"3) Blues, Latin jazz salsa, jazz xa, funk x3, 24/7/365 Wally’s Cafe Jazz club",Wally's Cafe Jazz Club,"42.340735169280684, -71.0822142949978",,
+A4,"4) Not to be confused with the Jesuit college in Worcester, this is a cathedral Cathedral",Cathedral of the Holy Cross,"42.340965725249276, -71.07004200293923",,
+A5,5) Lilli Ann K Rosenberg brainchild in the South End,Betances Mural (80%),"42.34236478201366, -71.07314991031272",,
+A6,"6) Not an above-ground railroad, she is remembered as one of the conductors",Harriet Tubman Memorial,"42.34355826498339, -71.0779098454636",,
+A7,7) Halloween's Michael + Community's Señor: ,Myers+Chang,"42.343917124461065, -71.06620549483627",,
+A8,8) This diner has a secret,Hidden Kitchen,"42.33836232114676, -71.0667887997758",,
+A9,9) Need budgeting advice? Take a page out of their book,,,,
+A10,"10) Go for the Spanish dancing, stay for the Spanish food",La Fabrica Central Restaurant,"42.363845469421676, -71.10129788828729",,
+A11,11) A place Petunia and Vernon would love to share a cup of coffee,"Dudley Cafe , Dudley Square","42.33000580911709, -71.08345739566941",,
+A12,12) The namesake of this house suggested bullets or ballots,Malcolm X House,"42.321503645221576, -71.0863561083245",,
+A13,13) A station honoring an ancient Nile kingdom → ,"Nubian Station, Roxbury","42.329719158213535, -71.08393017974034",,
+A14,"14) The sun, but in French.",soleil,"42.32995937830152, -71.08425706494715",,
+A15,15) Taking down bear proof cages is a lot harder than putting them up,old bear pens,"42.31163492909362, -71.0944883387719",,
+A16,"16) A high school for mayo, smoked turkey, cucumbers, tomatoes, and sprouts",,,,
+A17,17) Where to go when you need spaghetti in a hurry on the hill,Lily's Gourmet Pasta Express,"42.33240052352865, -71.10001875238213",,
+A18,18) The Jamaica Plain Tuesday Club is its steward,Loring Greenough House,"42.30940190779075, -71.11503165360074",,
+A19,19) Spooner finds 2020 chicago mayor at this theater (9 letters),Strand Theatre,"42.31599303331773, -71.0660247",,
+A20,"20) You won't find cows or pigs in this barn, but maybe a hot meal instead",noodle barn (?),"42.31145648101414, -71.11454193944768",,
+A21,21) The Crimson's green showcase,Harvard Arboretum,"42.30758360954152, -71.11986574437587",,
+A22,22) A not so functional seat to enjoy pond views,JAMACIA POND BENCH,"42.31703238067602, -71.1172176327592",,
+A23,"23) Grab a book from this famous labor organizer, it's plainly not a Haymarket affair",Lucy Parsons Center (Jamaica Plain),"42.32234399461923, -71.10765946762163",,
+A24,24) Go to this fire station to get an ice cold treat,fire station turned JP Licks,"42.312828161837565, -71.1142521044243",,
+A25,"25) Sorta like the death of an author, but (mil)more in bronze",Death and the Sculptor,,,"42.29783644453621, -71.10768546216663"
+A26,26) SD.2702 was recently passed here,Massachusetts State House,"42.35772690789592, -71.0636244852727",,
+A27,"27) Mae's performing here either today or tomorrow -> 158 Brighton Ave, Allston, MA 02134",Brighton Music Hall,"42.35296368437526, -71.13261242438084",,
+A28,"28) I don't know much about their baked goods, but the flag is a big plus",SWISS BAKERY ALSTON,"42.3632259246665, -71.12855843461686",,
+A29,"29) If you're looking for good Asian fusion, you'll find a bonch on Brighton Avenue",Bonchon Boston,"42.35298420423782, -71.13089261430888",,
A30,"30) Absalom, absalom! Listen closely for the sound and the fury at this memorial","Anderson bridge: a small brass plaque, the size of one brick, that is located on the
brick wall of the Eastern (Weld Boathouse) side of the bridge, just
north of the middle of the bridge span, about eighteen inches from the
ground in a small alcove. It reads:
""QUENTIN COMPSON
Drowned in the odour of honeysuckle.
-1891-1910""","42.36898885010578, -71.12306457136677",,
-A31,31) Don't go here for rescue from arson - even if you are only at O'Brien's,Boston Fire Dept. Station 41,"42.353802, -71.136116",,
-A32,32) CSM and IVM provide the name for this BC museum,McMullen Museum of art,"42.34038115716941, -71.16265204351588",,
-A33,33) A hammer thrower resides peacefully outside a former school named after Big Lub,Hal Connolly Statue,"42.35037729554579, -71.14555952509022",,
-A34,34 ) This Catalan restaurant will bring you to task ,Tasca Restaurant,"42.3434052435984, -71.14279038706111",,
-A35,35) The students here seem like they'll have a Bright future,Brighton High School,"42.34965767795442, -71.14606621964128",,
-A36,36) Going to the chapel and it's 1959 ,Harvard Class of 1959 Chapel,"42.36580905967968, -71.12374919164488",,
-A37,"37) This monument wasn't made by its subject, but it could have been",,,,
-A38,"38) Quack quack quack, their home on the Fens",agassiz road duck house,"42.34341395011007, -71.09317746727483",,
-A39,39) The less controversial MLK statue,MLK statue on BU campus,"42.35036326253947, -71.10650807481497",,
-A40,"40) This hotel kicked out St. George and caused a Black Sox scandal, Bucko!",Boston Hotel Buckminster,"42.348465223671944, -71.09776617622576",,
-A41,"41) Vitruvian, Viridian. Potato, potato. Find this place where all the people of Fenway can meet",The Viridian (Apartment Building that has Blaze Pizza),"42.34453026994564, -71.09720444433195",,
-A42,42) This pizza place loves fire so much they put it in the name!,Land of Fire Pizzeria,"42.34138871428725, -71.14657093175214",,
-A43,43) A BU student's go-to for Indian food,India Quality Restaurant,"42.3485725720217, -71.0942113926108",,
-A44,44) The statue of the son of the red,MAYBE Ted Williams Statue ,"42.34605480640728, -71.0960390033173",,
-A45,45) This citrus isn't supposed to be that color!,,,,
-A46,46) Boston Terriers love getting their tan on here,BU Beach,"42.35116095548625, -71.10606134524427",,
-A47,47) So she ran away in her sleep and dreamed of this rock,Paradise Rock Club (Commonwealth),"42.3518271762187, -71.11983863137432",,
-A48,48) Has better ratings than the noun motel or the adverb inn,The Verb Hotel,"42.34517137203154, -71.09676153399613",,
-A49,49) Supposedly the oldest playground in America,Cypress Street Playground,"42.3315920224197, -71.12571559999999",,
-A50,50) Ook een boek van Ann Patchett,The Dutch House,"42.335982955313646, -71.11231902990166",,
-A51,51) The home of the nation's best parkmaker,Frederick Law Olmstead National Historic Site,"42.32590914866024, -71.13228373433928",,
-A52,52) This Brookline shop might forge their own tomes,Brookline Booksmith,"42.342764551151554, -71.12168301640884",,
-A53,53) we we we we should should should should cross cross cross cross here here here here,Echo Bridge,"42.31487124359676, -71.22693938547769",,
-A54,54) This weekend it's hosting a Thanksgiving with Mary Baker Eddy,Longyear Museum,"42.32485823589608, -71.16189103410989",,
-A55,55) Steam engines so big they ll leave you crying,Waterworks Museum,"42.3320010747946, -71.15563010527421",,
-,,,,,
-,,,,,
-,,,,,
-,,,,,
-,Japanese Temple Bell at 9:30 in the Fens (right across the first foot bridge),,,,
-,"42.34132619174766, -71.09428257118488",,,, \ No newline at end of file
+1891-1910""","42.36898885010578, -71.12306457136677",,
+A31,31) Don't go here for rescue from arson - even if you are only at O'Brien's,Boston Fire Dept. Station 41,"42.353802, -71.136116",,
+A32,32) CSM and IVM provide the name for this BC museum,McMullen Museum of art,"42.34038115716941, -71.16265204351588",,
+A33,33) A hammer thrower resides peacefully outside a former school named after Big Lub,Hal Connolly Statue,"42.35037729554579, -71.14555952509022",,
+A34,34 ) This Catalan restaurant will bring you to task ,Tasca Restaurant,"42.3434052435984, -71.14279038706111",,
+A35,35) The students here seem like they'll have a Bright future,Brighton High School,"42.34965767795442, -71.14606621964128",,
+A36,36) Going to the chapel and it's 1959 ,Harvard Class of 1959 Chapel,"42.36580905967968, -71.12374919164488",,
+A37,"37) This monument wasn't made by its subject, but it could have been",,,,
+A38,"38) Quack quack quack, their home on the Fens",agassiz road duck house,"42.34341395011007, -71.09317746727483",,
+A39,39) The less controversial MLK statue,MLK statue on BU campus,"42.35036326253947, -71.10650807481497",,
+A40,"40) This hotel kicked out St. George and caused a Black Sox scandal, Bucko!",Boston Hotel Buckminster,"42.348465223671944, -71.09776617622576",,
+A41,"41) Vitruvian, Viridian. Potato, potato. Find this place where all the people of Fenway can meet",The Viridian (Apartment Building that has Blaze Pizza),"42.34453026994564, -71.09720444433195",,
+A42,42) This pizza place loves fire so much they put it in the name!,Land of Fire Pizzeria,"42.34138871428725, -71.14657093175214",,
+A43,43) A BU student's go-to for Indian food,India Quality Restaurant,"42.3485725720217, -71.0942113926108",,
+A44,44) The statue of the son of the red,MAYBE Ted Williams Statue ,"42.34605480640728, -71.0960390033173",,
+A45,45) This citrus isn't supposed to be that color!,,,,
+A46,46) Boston Terriers love getting their tan on here,BU Beach,"42.35116095548625, -71.10606134524427",,
+A47,47) So she ran away in her sleep and dreamed of this rock,Paradise Rock Club (Commonwealth),"42.3518271762187, -71.11983863137432",,
+A48,48) Has better ratings than the noun motel or the adverb inn,The Verb Hotel,"42.34517137203154, -71.09676153399613",,
+A49,49) Supposedly the oldest playground in America,Cypress Street Playground,"42.3315920224197, -71.12571559999999",,
+A50,50) Ook een boek van Ann Patchett,The Dutch House,"42.335982955313646, -71.11231902990166",,
+A51,51) The home of the nation's best parkmaker,Frederick Law Olmstead National Historic Site,"42.32590914866024, -71.13228373433928",,
+A52,52) This Brookline shop might forge their own tomes,Brookline Booksmith,"42.342764551151554, -71.12168301640884",,
+A53,53) we we we we should should should should cross cross cross cross here here here here,Echo Bridge,"42.31487124359676, -71.22693938547769",,
+A54,54) This weekend it's hosting a Thanksgiving with Mary Baker Eddy,Longyear Museum,"42.32485823589608, -71.16189103410989",,
+A55,55) Steam engines so big they ll leave you crying,Waterworks Museum,"42.3320010747946, -71.15563010527421",,
+B1,521 Commercial Street #525,521 Commercial Street #525,"42.3688272,-71.0553792",,
+B2,Acorn St,Acorn St,"42.3576234,-71.0688746",,
+B3,Arlington's Great Meadows,Arlington's Great Meadows,"42.4299758,-71.2038948",,
+B4,Arthur Fiedler Statue,Arthur Fiedler Statue,"42.3565057,-71.0754527",,
+B5,BU Beach,BU Beach,"42.3511927,-71.1060828",,
+B6,Blaze Pizza,Blaze Pizza,"42.3446263,-71.0969274",,
+B7,Bonchon Allston,Bonchon Allston,"42.35304,-71.130887",,
+B8,Boston Athenaeum,Boston Athenaeum,"42.3579151,-71.0620802",,
+B9,Boston Green Academy,Boston Green Academy,"42.3501823,-71.1459593",,
+B10,Boston Irish Famine Memorial,Boston Irish Famine Memorial,"42.357357,-71.0586014",,
+B11,Boston Massacre Site,Boston Massacre Site,"42.3587627,-71.0572023",,
+B12,Bova's Bakery,Bova's Bakery,"42.36521,-71.0556268",,
+B13,Brighton High School,Brighton High School,"42.3495825,-71.1460435",,
+B14,Brookline Booksmith,Brookline Booksmith,"42.3426377,-71.1217152",,
+B15,Citrus & Salt Boston,Citrus & Salt Boston,"42.3489004,-71.0720926",,
+B16,Cocoanut Grove Memorial Plaque,Cocoanut Grove Memorial Plaque,"42.3500079,-71.067859",,
+B17,Commodore John Barry Memorial,Commodore John Barry Memorial,"42.3556154,-71.0632036",,
+B18,Cypress Street Playground,Cypress Street Playground,"42.331864,-71.1258765",,
+B19,Dana-Farber Cancer Institute,Dana-Farber Cancer Institute,"42.3364675,-71.1095021",,
+B20,Danehy Park,Danehy Park,"42.3890049,-71.133103",,
+B21,Dave's Hot Chicken,Dave's Hot Chicken,"42.3248471,-71.0620134",,
+B22,Domingo F. Sarmiento Statue,Domingo F. Sarmiento Statue,"42.3500031,-71.0851891",,
+B23,Dutch House,Dutch House,"42.3360385,-71.1123834",,
+B24,Earl of Sandwich,Earl of Sandwich,"42.354296,-71.066414",,
+B25,Echo Bridge,Echo Bridge,"42.3145041,-71.2273649",,
+B26,Farmers Horse Coffee,Farmers Horse Coffee,"42.341987,-71.0834061",,
+B27,Fenway High School,Fenway High School,"42.3306454,-71.0992038",,
+B28,Isabella Stewart Gardner Museum,Isabella Stewart Gardner Museum,"42.3381442,-71.0990577",,
+B29,James Michael Curley Statues,James Michael Curley Statues,"42.3604952,-71.0569649",,
+B30,James P. Kelleher Rose Garden,James P. Kelleher Rose Garden,"42.3419564,-71.0949218",,
+B31,Japanese Bell,Japanese Bell,"42.3413301,-71.0942861",,
+B32,Joe Moakley Park,Joe Moakley Park,"42.3256817,-71.0498714",,
+B33,John Eliot Square,John Eliot Square,"42.329969,-71.0908104",,
+B34,Lafayette City Center,Lafayette City Center,"42.3537983,-71.0616035",,
+B35,Leader Bank Pavilion,Leader Bank Pavilion,"42.3485465,-71.0359433",,
+B36,Leif Erikson Statue,Leif Erikson Statue,"42.3490205,-71.0913583",,
+B37,Lilly's Gourmet Pasta Express,Lilly's Gourmet Pasta Express,"42.3323776,-71.1000217",,
+B38,LimeRed Teahouse (Boston),LimeRed Teahouse (Boston),"42.3518397,-71.1241295",,
+B39,Longyear Museum,Longyear Museum,"42.3245965,-71.1618052",,
+B40,Massachusetts State House,Massachusetts State House,"42.3587772,-71.0638101",,
+B41,"McMullen Museum of Art, Boston College","McMullen Museum of Art, Boston College","42.340795,-71.1625829",,
+B42,Menotomy Rocks Park,Menotomy Rocks Park,"42.4107892,-71.167854",,
+B43,Metropolitan Waterworks Museum,Metropolitan Waterworks Museum,"42.3317473,-71.155555",,
+B44,Mr. Crêpe,Mr. Crêpe,"42.3965778,-71.1227278",,
+B45,Muffin House Cafe,Muffin House Cafe,"42.3140229,-71.3598149",,
+B46,Petsi Pies,Petsi Pies,"42.3836229,-71.1126695",,
+B47,Polcari’s Coffee,Polcari’s Coffee,"42.3640137,-71.0555003",,
+B48,Porter,Porter,"42.3884,-71.119149",,
+B49,Puerto Rican Veterans Memorial,Puerto Rican Veterans Memorial,"42.3407613,-71.0712561",,
+B50,"Skinny House (Spite House) Boston, MA","Skinny House (Spite House) Boston, MA","42.3668968,-71.0561781",,
+B51,Soldiers and Sailors Monument,Soldiers and Sailors Monument,"42.3554589,-71.0664019",,
+B52,Starbucks,Starbucks,"42.359349,-71.059228",,
+B53,Steinert Hall,Steinert Hall,"42.3524116,-71.0668408",,
+B54,Sugar and Spice Ice Cream Cafe,Sugar and Spice Ice Cream Cafe,"42.2961434,-71.0872846",,
+B55,TD Garden,TD Garden,"42.366198,-71.062146",,
+B56,Tasca Restaurant,Tasca Restaurant,"42.3433772,-71.1427371",,
+B57,The Bagel Table,The Bagel Table,"42.3569102,-71.1438455",,
+B58,The Great Elm,The Great Elm,"42.3553972,-71.0651214",,
+B59,Tiananmen Memorial,Tiananmen Memorial,"42.3509517,-71.0596124",,
+B60,Yankee Lobster,Yankee Lobster,"42.3478381,-71.0359354",,
+B61,Yas Chicken - Allston,Yas Chicken - Allston,"42.3525708,-71.1313443",,
+B62,swissbakers,swissbakers,"42.3631904,-71.1284677",,
+C1,"""The Charlestown Bells"" by Paul Matisse","""The Charlestown Bells"" by Paul Matisse","42.3691906,-71.061757",,
+C2,"42°23'18.8""N 71°07'09.5""W","42°23'18.8""N 71°07'09.5""W","42.388547,-71.119301",,
+C3,Bow Market,Bow Market,"42.381008,-71.097883",,
+C4,Cambridge Public Library,Cambridge Public Library,"42.3741209,-71.1107166",,
+C5,Charlestown High School,Charlestown High School,"42.3803747,-71.0609962",,
+C6,Christopher Columbus Waterfront Park,Christopher Columbus Waterfront Park,"42.3609921,-71.0516339",,
+C7,Dawes Island,Dawes Island,"42.3754427,-71.1194344",,
+C8,Desfina Restaurant,Desfina Restaurant,"42.3675275,-71.0809932",,
+C9,Dino Safari Boston: A Walk-Thru Adventure,Dino Safari Boston: A Walk-Thru Adventure,"42.3597994,-71.0545357",,
+C10,F. A. Kennedy Steam Bakery,F. A. Kennedy Steam Bakery,"42.3627462,-71.1013044",,
+C11,Forge Baking Co & Ice Cream Bar,Forge Baking Co & Ice Cream Bar,"42.3838224,-71.1108423",,
+C12,Greentown Labs,Greentown Labs,"42.3820702,-71.1026937",,
+C13,Harvard Square,Harvard Square,"42.373465,-71.1189467",,
+C14,Igor Fokin memorial,Igor Fokin memorial,"42.3732344,-71.1208817",,
+C15,John F. Kennedy Presidential Library and Museum,John F. Kennedy Presidential Library and Museum,"42.316274,-71.0342146",,
+C16,Lechmere Canal Park,Lechmere Canal Park,"42.3695046,-71.0756902",,
+C17,Lynch Family Skatepark,Lynch Family Skatepark,"42.3701829,-71.0678704",,
+C18,Machu Chicken,Machu Chicken,"42.3799095,-71.0968274",,
+C19,Millers River Potato Monument,Millers River Potato Monument,"42.3718401,-71.0656594",,
+C20,"Museum of Fine Arts, Boston","Museum of Fine Arts, Boston","42.339381,-71.094048",,
+C21,P & E Microcomputer Systems Inc,P & E Microcomputer Systems Inc,"42.3621177,-71.1854722",,
+C22,Peabody Museum of Archaeology and Ethnology,Peabody Museum of Archaeology and Ethnology,"42.3782386,-71.1146697",,
+C23,Prospect Hill Monument,Prospect Hill Monument,"42.3817274,-71.0935443",,
+C24,Spirit Halloween,Spirit Halloween,"42.3551807,-71.0611749",,
+C25,Stata Center,Stata Center,"42.3616095,-71.0906355",,
+C26,The Collection of Historical Scientific Instruments at the Putnam Gallery,The Collection of Historical Scientific Instruments at the Putnam Gallery,"42.3766442,-71.1161887",,
+C27,The Engine,The Engine,"42.3627993,-71.0962734",,
+C28,The Harvard Museum of Natural History,The Harvard Museum of Natural History,"42.3784629,-71.1155576",,
+C29,The Mµseum (tiny museum),The Mµseum (tiny museum),"42.3797674,-71.0949101",,
+C30,The Nu Do' Society,The Nu Do' Society,"42.3640287,-71.1087411",,
+C31,USS Constitution Museum,USS Constitution Museum,"42.3739796,-71.0554239",,
+C32,Union Square,Union Square,"42.37736,-71.09476",,
+C33,University Park Commons,University Park Commons,"42.3614115,-71.1014951",,
+C34,Veggie Crust - Somerville,Veggie Crust - Somerville,"42.3822934,-71.1024769",,
+C35,Veggie Galaxy,Veggie Galaxy,"42.3636597,-71.1011111",,
+C36,Warren Tavern,Warren Tavern,"42.3741694,-71.0631664",,
+D1,"42°21'41.5""N 71°03'24.6""W","42°21'41.5""N 71°03'24.6""W","42.361531,-71.056823",,
+D2,All Saints Church,All Saints Church,"42.2857047,-71.0632852",,
+D3,Ashmont,Ashmont,"42.2845163,-71.0637877",,
+D4,Boston Children's Museum,Boston Children's Museum,"42.3519736,-71.0496839",,
+D5,Boston College High School,Boston College High School,"42.3162356,-71.0454645",,
+D6,Boston Design Center,Boston Design Center,"42.3441918,-71.0336324",,
+D7,Boston Fire Museum,Boston Fire Museum,"42.3508756,-71.0487437",,
+D8,Boston Tea Party Ships & Museum,Boston Tea Party Ships & Museum,"42.3521821,-71.0512911",,
+D9,Braintree,Braintree,"42.2075316,-71.0013637",,
+D10,Bunker Hill Monument,Bunker Hill Monument,"42.3763541,-71.0607764",,
+D11,Calf Pasture Pumping Station,Calf Pasture Pumping Station,"42.316031,-71.0374911",,
+D12,Castle Island,Castle Island,"42.3378699,-71.0125206",,
+D13,Edgar Allan Poe Statue,Edgar Allan Poe Statue,"42.3523158,-71.0672898",,
+D14,Forbes Hill Standpipe,Forbes Hill Standpipe,"42.2576602,-71.02832",,
+D15,Glenn’s Kreme&Kone at the Hood Milk Bottle,Glenn’s Kreme&Kone at the Hood Milk Bottle,"42.3516479,-71.0502126",,
+D16,ICA Watershed,ICA Watershed,"42.3639107,-71.0331956",,
+D17,Institute of Contemporary Art,Institute of Contemporary Art,"42.3528151,-71.0432778",,
+D18,John Adams Birthplace - Adams National Historical Park,John Adams Birthplace - Adams National Historical Park,"42.2392354,-71.0035279",,
+D19,John Joseph Moakley United States Courthouse,John Joseph Moakley United States Courthouse,"42.3537343,-71.0470633",,
+D20,L Street Bathhouse,L Street Bathhouse,"42.3291218,-71.0352443",,
+D21,Massachusetts Historical Society,Massachusetts Historical Society,"42.3463992,-71.0898829",,
+D22,O B's Cafe,O B's Cafe,"42.2743442,-71.0240951",,
+D23,Pleasure Bay,Pleasure Bay,"42.3358743,-71.0234949",,
+D24,Revere Beach,Revere Beach,"42.420226,-70.985881",,
+D25,Schoolhouse Pizza,Schoolhouse Pizza,"42.2454086,-71.0005483",,
+D26,"South Boston Korean War Memorial, Castle Island, South Boston, - Massachusetts, USA","South Boston Korean War Memorial, Castle Island, South Boston, - Massachusetts, USA","42.3367603,-71.0096371",,
+D27,Taiyaki NYC - Boston,Taiyaki NYC - Boston,"42.3509709,-71.0447796",,
+D28,Tavern of Tales: Café & Bar,Tavern of Tales: Café & Bar,"42.3319001,-71.0983169",,
+D29,The Clam Box,The Clam Box,"42.2763168,-71.0092883",,
+D30,The Partisans,The Partisans,"42.3478375,-71.0404428",,
+D31,Union Oyster House,Union Oyster House,"42.361288,-71.056908",,
+D32,Victoria's Diner,Victoria's Diner,"42.3270498,-71.0667744",,
+D33,Wollaston Beach,Wollaston Beach,"42.2806539,-71.0119933",,
diff --git a/dashboard_website/router.py b/dashboard_website/router.py
index 70af4c6..385cbae 100644
--- a/dashboard_website/router.py
+++ b/dashboard_website/router.py
@@ -101,33 +101,37 @@ def cluster_and_optimize(
# assign pre-determined clues to bikes
already_assigned_clues = []
routes = [[] for i in bikes]
- for clue in clues:
- if clue.assigned_team != 0 and ((clue.assigned_team-1) in active_indices):
- routes[clue.assigned_team - 1].append(clue)
- already_assigned_clues.append(clue)
-
# if we are not doing a hard reset, keep the current target clues
if minimal:
for i, bike in enumerate(bikes):
- if (bike.status != "DISABLED") and (bike.target_clue != None) and (bike.target_clue not in routes[i]):
- routes[i].append(bike.target_clue)
- already_assigned_clues.append(clue)
+ if (bike.status != "DISABLED") and (bike.target_clue != None):
+ #routes[i].append(bike.target_clue)
+ print("Already assigned clue at: ", bike.target_clue)
+ already_assigned_clues.append(bike.target_clue)
+ for clue in clues:
+ if clue.assigned_team != 0 and ((clue.assigned_team-1) in active_indices) and (clue not in already_assigned_clues):
+ routes[clue.assigned_team - 1].append(clue)
+ already_assigned_clues.append(clue)
# Split the remaining clues into clusters based on the cluster labels
for i, label in enumerate(kmeans.labels_):
if clues[i].assigned_team == 0 and (clues[i] not in already_assigned_clues):
routes[active_indices[label]].append(clues[i])
- routes = __minimize_route_time_diff(routes, bikes, end, minimal, time_diff)
+ routes, times = __minimize_route_time_diff(routes, bikes, end, minimal, time_diff)
if routes == -1:
return -1, [], [], []
# Remove waypoints from the longest route until the trip time is less than the max time
- for i in range(len(routes)):
- resp = __remove_longest_waypoints(routes[i], bikes[i], end, max(bikes[i].timeTilDeadline()/3600, max_max_time))
- if resp == -1:
- return -1, [], [], []
- routes[i] = resp
+ #for i in range(len(routes)):
+ # resp = __remove_longest_waypoints(routes[i], bikes[i], end, max(max_max_time, bikes[i].timeTilDeadline()/3600), minimal)
+ # if resp == -1:
+ # return -1, [], [], []
+ # routes[i] = resp
+ clue_pool = []
+ routes = __balance_waypoints(routes, bikes, end, times, clue_pool, max_max_time, minimal)
+ if routes == -1:
+ return -1, [], [], []
# Get the json of the routes
route_waypoints = []
@@ -151,8 +155,10 @@ def cluster_and_optimize(
for i, route in enumerate(routes):
route2 = ["" for x in route]
start_index = 0 if (minimal and (bikes[i].target_clue != None)) else 1 # if starting route with first clue, first index of trip must be included
- for j, k in enumerate(route_waypoints[i][start_index:-1]):
+ for j, k in enumerate(route_waypoints[i][1:-1]):
route2[k["waypoint_index"] - 1] = route[j]
+ if (minimal and (bikes[i].target_clue != None)):
+ route2.insert(0, bikes[i].target_clue)
routes[i] = route2
return status, routes, geometries, times
@@ -184,7 +190,7 @@ def __get_json(coordinate_string, start, end):
+ start
+ coordinate_string
+ end
- + "?roundtrip=false&source=first&destination=last&geometries=geojson&overview=full"
+ + "?roundtrip=false&source=first&destination=last&geometries=geojson&overview=full&exclude=ferry"
)
coordinates = coordinates.json()
@@ -208,7 +214,7 @@ def __get_trip_time(
+ start
+ coordinate_string
+ end
- + "?roundtrip=false&source=first&destination=last"
+ + "?roundtrip=false&source=first&destination=last&exclude=ferry"
)
coordinates = coordinates.json()
@@ -266,9 +272,9 @@ def __minimize_route_time_diff(
if time_difference > time_diff:
# Move a coordinate from the longest route to the shortest route
for _ in range(max(1,int(time_difference/0.12))): # roughly estimate how many points must be moved to equalize
- closest_coordinate = __find_closest_coordinate(
+ closest_coordinate = __find_closest_coordinates(
routes[active_indices[sorted_indices[-1]]], __mean_center(routes[sorted_indices[0]])
- )
+ )[0]
routes[active_indices[sorted_indices[0]]].append(closest_coordinate)
routes[active_indices[sorted_indices[-1]]].remove(closest_coordinate)
@@ -276,11 +282,67 @@ def __minimize_route_time_diff(
return __minimize_route_time_diff(routes, bikes, end, minimal, time_diff)
# If the difference of the longest trip time from average is less than the time difference, return the routes
- return routes
+ return routes, times
+
+def __balance_waypoints(
+ routes: [Clue], bikes: [Bike], end: Point, times, clue_pool: [Clue], max_time, minimal
+):
+ """
+ Takes a list of coordinates, a start point, an end point, and a maximum time and returns a list of coordinates
+ :param route_coordinates: the list of coordinates
+ :param start: the start point
+ :param end: the end point
+ :param max_time: the maximum time
+ :return: a list of coordinates
+ """
+
+ if db.should_cancel_routing(): return -1
+ active_indices = [i for i in range(len(bikes)) if bikes[i].status != "DISABLED"]
+ starts = [ bike.target_clue if (minimal and (bike.target_clue != None)) else bike for bike in bikes ] # all bikes regardless of enabled
+ max_times = [ max(bike.timeTilDeadline()/3600, max_time) for bike in bikes ]
+ time_balances = [ (max_times[i] - times[i]) for i in range(len(times))]
+
+ balanced = True
+ for balance in time_balances:
+ if balance < 0:
+ balanced = False
+ break
+ if balanced:
+ return routes
+ # shorten too-long routes
+ for i, time_balance in enumerate(time_balances):
+ print(i, time_balance)
+ if time_balance < 0: # route too long
+ route_mean = __mean_center(routes[active_indices[i]])
+ farthest_coordinates = __find_farthest_coordinates(routes[active_indices[i]], route_mean, max(1,min(int(-1*time_balance/0.12),int(len(routes[active_indices[i]])*0.75))))
+ for farthest_coordinate in farthest_coordinates:
+ routes[active_indices[i]].remove(farthest_coordinate)
+ clue_pool.append(farthest_coordinate)
+ # lengthen routes with spare room
+ for i, time_balance in enumerate(time_balances):
+ if time_balance > 0.15: # route too short
+ route_mean = __mean_center(routes[active_indices[i]])
+ closest_coordinates = __find_closest_coordinates(clue_pool, route_mean, 1)
+ for closest_coordinate in closest_coordinates:
+ routes[active_indices[i]].append(closest_coordinate)
+ clue_pool.remove(closest_coordinate)
+
+ for i, route in enumerate(routes):
+ if bikes[i].status == "DISABLED": continue
+ if db.should_cancel_routing(): return -1
+ times[active_indices[i]] = __get_trip_time(
+ __clues_to_string(route),
+ len(route),
+ __clues_to_string([starts[i]]),
+ __clues_to_string([end])[:-1],
+ ) * bikes[i].time_modifier
+
+ return __balance_waypoints(routes, bikes, end, times, clue_pool, max_time, minimal)
+
def __remove_longest_waypoints(
- route_coordinates: [Clue], start: Bike, end: Point, max_time, start_already_set=False
+ route_coordinates: [Clue], start: Bike, end: Point, max_time, minimal, start_already_set=False
):
"""
Takes a list of coordinates, a start point, an end point, and a maximum time and returns a list of coordinates
@@ -297,7 +359,7 @@ def __remove_longest_waypoints(
print(max_time)
- if start.status != "DISABLED" and start.target_clue != None: # already assigned a clue
+ if minimal and (start.status != "DISABLED") and (start.target_clue != None): # already assigned a clue
start = start.target_clue
# Find the trip time for the route
route_time = __get_trip_time(
@@ -315,11 +377,13 @@ def __remove_longest_waypoints(
for farthest_coordinate in farthest_coordinates:
route_coordinates.remove(farthest_coordinate)
- return __remove_longest_waypoints(route_coordinates, start, end, max_time, start_already_set=True)
+ return __remove_longest_waypoints(route_coordinates, start, end, max_time, minimal, start_already_set=True)
return route_coordinates
+
+
def __normalize_points(clues: [Clue], bikes: [Bike]):
"""
Takes a list of coordinates and a list of centroids and returns a list of normalized coordinates and a list of
@@ -372,23 +436,34 @@ def __min_max_normalize(value, min_value, max_value):
return (value - min_value) / (max_value - min_value)
-def __find_closest_coordinate(clues: [Clue], centroid: Point):
+def __find_closest_coordinates(clues: [Clue], centroid: Point, n:int=1):
"""
Takes a list of coordinates and a centroid and returns the clue in the list that is closest to the centroid
:param clues: the list of coordinates
:param centroid: the centroid
:return: the clue in the list that is closest to the centroid
"""
+
# Convert the clues to a list of points
- closest_coordinate = clues[0]
- closest_coordinate_distance = __distance(closest_coordinate, centroid)
+ closest_coordinates = []
+ for _ in range(min(n, len(clues))):
+ closest_coordinate = clues[0]
+ # remove only unrequired clues
+ i = 1
+ while closest_coordinate in closest_coordinates:
+ closest_coordinate = clues[i]
+ i += 1
- for clue in clues:
- if __distance(clue, centroid) < closest_coordinate_distance:
- closest_coordinate = clue
- closest_coordinate_distance = __distance(clue, centroid)
+ closest_coordinate_distance = __distance(closest_coordinate, centroid)
- return closest_coordinate
+ for clue in clues:
+ if __distance(clue, centroid) < closest_coordinate_distance and (clue not in closest_coordinates):
+ closest_coordinate = clue
+ closest_coordinate_distance = __distance(clue, centroid)
+
+ closest_coordinates.append(closest_coordinate)
+
+ return closest_coordinates
def __find_farthest_coordinates(clues: [Clue], centroid: Point, n:int=1):
@@ -400,8 +475,7 @@ def __find_farthest_coordinates(clues: [Clue], centroid: Point, n:int=1):
"""
farthest_coordinates = []
-
- for _ in range(n):
+ for _ in range(min(len(clues),n)):
farthest_coordinate = clues[0]
# remove only unrequired clues
i = 1
diff --git a/dashboard_website/savefile.csv b/dashboard_website/savefile.csv
index a5ce1e0..22fa699 100644
--- a/dashboard_website/savefile.csv
+++ b/dashboard_website/savefile.csv
@@ -1,57 +1 @@
-name,latitude,longitude,info,status
-A1,42.3430402738135,-71.0675801105357,Peters Park,UNVISITED
-A3,42.340735169280684,-71.0822142949978,Wally's Cafe Jazz Club,UNVISITED
-A4,42.340965725249276,-71.07004200293923,Cathedral of the Holy Cross,UNVISITED
-A5,42.34236478201366,-71.07314991031272,Betances Mural (80%),UNVISITED
-A6,42.34355826498339,-71.0779098454636,Harriet Tubman Memorial,UNVISITED
-A7,42.343917124461065,-71.06620549483627,Myers+Chang,UNVISITED
-A8,42.33836232114676,-71.0667887997758,Hidden Kitchen,UNVISITED
-A10,42.363845469421676,-71.10129788828729,La Fabrica Central Restaurant,UNVISITED
-A11,42.33000580911709,-71.08345739566941,"Dudley Cafe , Dudley Square",UNVISITED
-A12,42.321503645221576,-71.0863561083245,Malcolm X House,UNVISITED
-A13,42.329719158213535,-71.08393017974034,"Nubian Station, Roxbury",UNVISITED
-A14,42.32995937830152,-71.08425706494715,soleil,UNVISITED
-A15,42.31163492909362,-71.0944883387719,old bear pens,UNVISITED
-A17,42.33240052352865,-71.10001875238213,Lily's Gourmet Pasta Express,UNVISITED
-A18,42.30940190779075,-71.11503165360074,Loring Greenough House,UNVISITED
-A19,42.31599303331773,-71.0660247,Strand Theatre,UNVISITED
-A20,42.31145648101414,-71.11454193944768,noodle barn (?),UNVISITED
-A21,42.30758360954152,-71.11986574437587,Harvard Arboretum,UNVISITED
-A22,42.31703238067602,-71.1172176327592,JAMACIA POND BENCH,UNVISITED
-A23,42.32234399461923,-71.10765946762163,Lucy Parsons Center (Jamaica Plain),UNVISITED
-A24,42.312828161837565,-71.1142521044243,fire station turned JP Licks,UNVISITED
-A26,42.35772690789592,-71.0636244852727,Massachusetts State House,UNVISITED
-A27,42.35296368437526,-71.13261242438084,Brighton Music Hall,UNVISITED
-A28,42.3632259246665,-71.12855843461686,SWISS BAKERY ALSTON,UNVISITED
-A29,42.35298420423782,-71.13089261430888,Bonchon Boston,UNVISITED
-A30,42.36898885010578,-71.12306457136677,"Anderson bridge: a small brass plaque, the size of one brick, that is located on the
-brick wall of the Eastern (Weld Boathouse) side of the bridge, just
-north of the middle of the bridge span, about eighteen inches from the
-ground in a small alcove. It reads:
-""QUENTIN COMPSON
-Drowned in the odour of honeysuckle.
-1891-1910""",UNVISITED
-A31,42.353802,-71.136116,Boston Fire Dept. Station 41,UNVISITED
-A32,42.34038115716941,-71.16265204351588,McMullen Museum of art,UNVISITED
-A33,42.35037729554579,-71.14555952509022,Hal Connolly Statue,UNVISITED
-A34,42.3434052435984,-71.14279038706111,Tasca Restaurant,UNVISITED
-A35,42.34965767795442,-71.14606621964128,Brighton High School,UNVISITED
-A36,42.36580905967968,-71.12374919164488,Harvard Class of 1959 Chapel,UNVISITED
-A38,42.34341395011007,-71.09317746727483,agassiz road duck house,UNVISITED
-A39,42.35036326253947,-71.10650807481497,MLK statue on BU campus,UNVISITED
-A40,42.348465223671944,-71.09776617622576,Boston Hotel Buckminster,UNVISITED
-A41,42.34453026994564,-71.09720444433195,The Viridian (Apartment Building that has Blaze Pizza),UNVISITED
-A42,42.34138871428725,-71.14657093175214,Land of Fire Pizzeria,UNVISITED
-A43,42.3485725720217,-71.0942113926108,India Quality Restaurant,UNVISITED
-A44,42.34605480640728,-71.0960390033173,MAYBE Ted Williams Statue ,UNVISITED
-A46,42.35116095548625,-71.10606134524427,BU Beach,UNVISITED
-A47,42.3518271762187,-71.11983863137432,Paradise Rock Club (Commonwealth),UNVISITED
-A48,42.34517137203154,-71.09676153399613,The Verb Hotel,UNVISITED
-A49,42.3315920224197,-71.12571559999999,Cypress Street Playground,UNVISITED
-A50,42.335982955313646,-71.11231902990166,The Dutch House,UNVISITED
-A51,42.32590914866024,-71.13228373433928,Frederick Law Olmstead National Historic Site,UNVISITED
-A52,42.342764551151554,-71.12168301640884,Brookline Booksmith,UNVISITED
-A53,42.31487124359676,-71.22693938547769,Echo Bridge,UNVISITED
-A54,42.32485823589608,-71.16189103410989,Longyear Museum,UNVISITED
-A55,42.3320010747946,-71.15563010527421,Waterworks Museum,UNVISITED
-SAVS,42.356,-71.06,savenors,UNVISITED
+name,latitude,longitude,info,status,required
diff --git a/dashboard_website/static/js/dashboard.js b/dashboard_website/static/js/dashboard.js
index 4ab8670..f5ca3b3 100644
--- a/dashboard_website/static/js/dashboard.js
+++ b/dashboard_website/static/js/dashboard.js
@@ -380,8 +380,29 @@ function requestLatestInfo(){
updateClueStats();
}
- document.getElementById("routeinfo").innerHTML = json['calculating_routes'] ? "ROUTE INFO | <span style='color:orange'>(Calculating... <a href='#' onclick='stopRouting()'>(Force Stop)</a>)</span>" : "ROUTE INFO";
- if(json['routes_to_commit'])document.getElementById("routeinfo").innerHTML += "| <a href='#' onclick='commitRoutes()'>Commit preview routes</a>"
+ document.getElementById("routeinfo").innerHTML = json['calculating_routes'] ? "ROUTE INFO | <span style='color:orange'>Calculating... " : "ROUTE INFO";
+ var commit_btn = document.getElementById("apply_routes_btn");
+ var cancel_btn = document.getElementById("cancel_route_btn");
+ var gen_btn = document.getElementById("generate_routes_btn");
+ var min_btn = document.getElementById("toggle_minimal_btn");
+ if(json['minimal_routing']){
+ min_btn.innerText = "SET FULL ROUTING";
+ } else {
+ min_btn.innerText = "SET MINIMAL ROUTING";
+ }
+ if(json['routes_to_commit']){
+ commit_btn.disabled = false;
+ } else {
+ commit_btn.disabled = true;
+ }
+ if (json['calculating_routes']){
+ cancel_btn.disabled = false;
+ gen_btn.disabled = true;
+ } else {
+ cancel_btn.disabled = true;
+ gen_btn.disabled = false;
+ }
+ //if(json['routes_to_commit'])document.getElementById("routeinfo").innerHTML += "| <a href='#' onclick='commitRoutes()'>Commit preview routes</a>"
}
fetch(host+'/getLatestInfo', {
method: "POST",
@@ -403,6 +424,15 @@ function stopRouting(){
}).then( res => requestLatestInfo());
}
+function generateRoutes(){
+ var formData = new FormData();
+ formData.append("command", "generateRoutes");
+ fetch(host+'/controls', {
+ method: "POST",
+ body: formData
+ }).then( res => requestLatestInfo());
+}
+
function commitRoutes(){
var formData = new FormData();
formData.append("command", "commitRoutes");
@@ -412,6 +442,15 @@ function commitRoutes(){
}).then( res => requestLatestInfo());
}
+function toggleMinimal(){
+ var formData = new FormData();
+ formData.append("command", "toggleMinimal");
+ fetch(host+'/controls', {
+ method: "POST",
+ body: formData
+ }).then( res => requestLatestInfo());
+}
+
function onDeadlineChange(element){
var team_index = parseInt(element.id.split("_")[1]);
var new_deadline = element.value;
diff --git a/dashboard_website/templates/index.html b/dashboard_website/templates/index.html
index 60e6eaf..f3a947c 100644
--- a/dashboard_website/templates/index.html
+++ b/dashboard_website/templates/index.html
@@ -149,6 +149,17 @@
<div class="route-controls">
<span style="margin:-1px;margin-left:5px;margin-top:5px;" id="routeinfo">ROUTE INFO</span>
<hr style="width:100%;padding:0px;"/>
+ <table style="margin-top:-5px; width:100%">
+ <tr style="width:100%">
+ <td style="width:40%"> <!-- control buttons -->
+ <button disabled id='generate_routes_btn' onclick="generateRoutes()" style="width:150px">GENERATE ROUTES</button> <button disabled id='cancel_route_btn' onclick='stopRouting()' style="width:150px">CANCEL ROUTE GEN</button> <br/>
+ <button id='toggle_minimal_btn' onclick="toggleMinimal()" style="width:150px">SET MINIMAL</button> <button disabled id='apply_routes_btn' onclick='commitRoutes()' style="width:150px">APPLY PREVIEW ROUTES</button>
+ </td>
+ <td id="route_info_cell">
+
+ </td>
+ </tr>
+ </table>
<!--<input type="time" id="endtime" value="18:30">-->
</div>
</div>