From e81b8ff853d53ae858405ed9d5137c03b84c833c Mon Sep 17 00:00:00 2001 From: Aymeric Chaumont <aymeric.chaumont@student-cs.fr> Date: Mon, 11 Jul 2022 10:24:36 +0200 Subject: [PATCH] other conflicts and oversights --- backend/db/crud.py | 11 +---------- backend/db/models.py | 4 ---- backend/routers/stats.py | 5 +++++ frontend/src/components/WaitingTime.js | 2 +- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/backend/db/crud.py b/backend/db/crud.py index 3254367..2242dbc 100644 --- a/backend/db/crud.py +++ b/backend/db/crud.py @@ -13,13 +13,8 @@ from db import models, schemas def get_waiting_time(place: str, db: Session): """ Get the last estimated waiting time for the given place """ -<<<<<<< HEAD current_date = datetime.now(tz=pytz.timezone("Europe/Paris")) weekday, current_time = current_date.weekday(), date.time() -======= - date = datetime.now(tz=pytz.timezone("Europe/Paris")) - weekday, current_time = date.weekday(), date.time() ->>>>>>> 00d9b2c9fa55c3e0926b456eb76b17b94ad9d45a first_timeslot = get_timeslot(place, weekday, True, db) if first_timeslot and current_time < first_timeslot[0]: return first_timeslot[0].hour, first_timeslot[0].minute @@ -49,11 +44,7 @@ def get_waiting_time(place: str, db: Session): return None, None -<<<<<<< HEAD def get_avg_graph_points(place: str, weekday: int, min_time: time, max_time: time, interval: timedelta, db: Session): -======= -def get_stats(place: str, weekday: int, min_time: time, max_time: time, interval: timedelta, db: Session): ->>>>>>> 00d9b2c9fa55c3e0926b456eb76b17b94ad9d45a """ Get the average waiting time for each interval between two time steps """ def shift_time(t: time, delta: timedelta): @@ -96,7 +87,7 @@ def get_stats(place: str, weekday: int, min_time: time, max_time: time, interval return stats -def get_next_avg_graph(place: str, db: Session): +def get_avg_graph(place: str, db: Session): """ Get the average waiting time for each interval between two time steps, for the current or next available timeslot""" current_date = datetime.now(tz=pytz.timezone("Europe/Paris")) diff --git a/backend/db/models.py b/backend/db/models.py index 2346dd9..aa055fe 100644 --- a/backend/db/models.py +++ b/backend/db/models.py @@ -48,8 +48,4 @@ class OpeningHours(Base): day = Column(Integer) timeslot = Column(Boolean) open_time = Column(Time) -<<<<<<< HEAD close_time = Column(Time) -======= - close_time = Column(Time) ->>>>>>> 00d9b2c9fa55c3e0926b456eb76b17b94ad9d45a diff --git a/backend/routers/stats.py b/backend/routers/stats.py index 52efe45..290d662 100644 --- a/backend/routers/stats.py +++ b/backend/routers/stats.py @@ -16,3 +16,8 @@ async def waiting_time(place: str, db: Session = Depends(get_db)): @router.get('/{place}/stats/avg_graph', response_model=list) async def stats(place: str, db: Session = Depends(get_db)): return crud.get_avg_graph(place, db) + + +@router.get('/{place}/stats/current_graph', response_model=list) +async def stats(place: str, db: Session = Depends(get_db)): + return crud.get_current_graph(place, db) diff --git a/frontend/src/components/WaitingTime.js b/frontend/src/components/WaitingTime.js index 1662b1d..806caf2 100644 --- a/frontend/src/components/WaitingTime.js +++ b/frontend/src/components/WaitingTime.js @@ -4,7 +4,7 @@ import axios from "axios"; import "../styles/WaitingTime.css"; export default function WaitingTime({ place }) { - const [post, setPost] = useState(null); + const [post, setPost] = useState([null, null]); React.useEffect(() => { axios -- GitLab