Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
all: rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OxygenCobalt committed Mar 26, 2024
1 parent 138b64c commit 84f4407
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
15 changes: 15 additions & 0 deletions backend/src/handlers/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
FIELD_LONGITUDE = "longitude"
FIELD_DESCRIPTION = "description"
FIELD_STOPS = "stops"
FIELD_COLOR = "color"
INCLUDES = {FIELD_STOP_IDS, FIELD_WAYPOINTS, FIELD_IS_ACTIVE, FIELD_STOPS}

router = APIRouter(prefix="/routes", tags=["routes"])
Expand Down Expand Up @@ -81,6 +82,9 @@ def get_routes(
if FIELD_IS_ACTIVE in include_set:
route_json[FIELD_IS_ACTIVE] = is_route_active(route.id, alert, session)

if FIELD_STOPS in include_set:
route_json[FIELD_STOPS] = query_route_stops(route.id, alert, session)

routes_json.append(route_json)

return routes_json
Expand Down Expand Up @@ -227,6 +231,9 @@ def get_route(
alert = get_current_alert(datetime.now(timezone.utc), session)
route_json[FIELD_IS_ACTIVE] = is_route_active(route.id, alert, session)

if FIELD_STOPS in include_set:
route_json[FIELD_STOPS] = query_route_stops(route.id, alert, session)

return route_json


Expand Down Expand Up @@ -401,6 +408,14 @@ async def create_route(req: Request, kml_file: UploadFile):
if isinstance(style, PolyStyle):
color = style.color
break

if route_name == "Tungsten":
color = "#cc4628"
elif route_name == "Silver":
color = "#879ec3"
elif route_name == "Gold":
color = "#f1b91a"

# Want the text contents of all of the surface-level divs and then strip
# all of the tags of it's content

Expand Down
9 changes: 4 additions & 5 deletions backend/src/handlers/stops.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from fastapi import APIRouter, HTTPException, Query, Request
from pydantic import BaseModel
from src.model.alert import Alert
from src.model.route import Route
from src.model.route_disable import RouteDisable
from src.model.route_stop import RouteStop
from src.model.stop import Stop
from src.model.stop_disable import StopDisable
Expand All @@ -23,10 +25,7 @@
FIELD_COLORS = "colors"
FIELD_COLOR = "color"
FIELD_ROUTES = "routes"
INCLUDES = {
FIELD_ROUTE_IDS,
FIELD_IS_ACTIVE,
}
INCLUDES = {FIELD_ROUTE_IDS, FIELD_IS_ACTIVE, FIELD_COLORS, FIELD_ROUTES}

router = APIRouter(prefix="/stops", tags=["stops"])

Expand Down Expand Up @@ -117,7 +116,7 @@ def get_stop(
return stop_json


def query_stop_colors(stop_id: int, session) -> List[str]:
def query_stop_colors(stop_id: int, session) -> list[str]:
"""
Queries and returns the color of the stop.
"""
Expand Down

0 comments on commit 84f4407

Please sign in to comment.