Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ViaResto-website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aymeric Chaumont
ViaResto-website
Commits
72b243de
Commit
72b243de
authored
Jul 12, 2022
by
Aymeric Chaumont
Browse files
Options
Downloads
Plain Diff
Merge branch 'css_fix' into 'main'
readyfix See merge request
!35
parents
dece6655
16f1e3cd
No related branches found
No related tags found
1 merge request
!35
readyfix
Pipeline
#44009
passed
Jul 12, 2022
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/db/crud.py
+10
-7
10 additions, 7 deletions
backend/db/crud.py
backend/main.py
+2
-2
2 additions, 2 deletions
backend/main.py
frontend/src/components/WaitingTime.js
+1
-1
1 addition, 1 deletion
frontend/src/components/WaitingTime.js
with
13 additions
and
10 deletions
backend/db/crud.py
+
10
−
7
View file @
72b243de
...
@@ -21,14 +21,15 @@ def get_waiting_time(place: str, db: Session):
...
@@ -21,14 +21,15 @@ def get_waiting_time(place: str, db: Session):
data
[
"
next_timetable
"
]
=
"
{:d}h{:02d}
"
.
format
(
first_timeslot
[
0
].
hour
,
first_timeslot
[
0
].
minute
)
data
[
"
next_timetable
"
]
=
"
{:d}h{:02d}
"
.
format
(
first_timeslot
[
0
].
hour
,
first_timeslot
[
0
].
minute
)
return
data
return
data
elif
first_timeslot
and
current_time
<=
first_timeslot
[
1
]:
elif
first_timeslot
and
current_time
<=
first_timeslot
[
1
]:
waiting_time
=
db
.
query
(
last_record
=
db
.
query
(
models
.
Records
.
waiting_time
models
.
Records
.
waiting_time
).
filter
(
).
filter
(
models
.
Records
.
place
==
place
models
.
Records
.
place
==
place
).
order_by
(
).
order_by
(
models
.
Records
.
date
.
desc
()
models
.
Records
.
date
.
desc
()
).
first
()
).
first
()
if
waiting_time
:
if
last_record
:
waiting_time
=
last_record
.
waiting_time
waiting_time
=
round
(
waiting_time
.
total_seconds
()
/
60
)
waiting_time
=
round
(
waiting_time
.
total_seconds
()
/
60
)
data
[
"
status
"
]
=
True
data
[
"
status
"
]
=
True
data
[
"
waiting_time
"
]
=
waiting_time
data
[
"
waiting_time
"
]
=
waiting_time
...
@@ -38,14 +39,15 @@ def get_waiting_time(place: str, db: Session):
...
@@ -38,14 +39,15 @@ def get_waiting_time(place: str, db: Session):
data
[
"
next_timetable
"
]
=
"
{:d}h{:02d}
"
.
format
(
second_timeslot
[
0
].
hour
,
second_timeslot
[
0
].
minute
)
data
[
"
next_timetable
"
]
=
"
{:d}h{:02d}
"
.
format
(
second_timeslot
[
0
].
hour
,
second_timeslot
[
0
].
minute
)
return
data
return
data
elif
second_timeslot
and
current_time
<=
second_timeslot
[
1
]:
elif
second_timeslot
and
current_time
<=
second_timeslot
[
1
]:
waiting_time
=
db
.
query
(
last_record
=
db
.
query
(
models
.
Records
.
waiting_time
models
.
Records
.
waiting_time
).
filter
(
).
filter
(
models
.
Records
.
place
==
place
models
.
Records
.
place
==
place
).
order_by
(
).
order_by
(
models
.
Records
.
date
.
desc
()
models
.
Records
.
date
.
desc
()
).
first
()
).
first
()
if
waiting_time
:
if
last_record
:
waiting_time
=
last_record
.
waiting_time
waiting_time
=
round
(
waiting_time
.
total_seconds
()
/
60
)
waiting_time
=
round
(
waiting_time
.
total_seconds
()
/
60
)
data
[
"
status
"
]
=
True
data
[
"
status
"
]
=
True
data
[
"
waiting_time
"
]
=
waiting_time
data
[
"
waiting_time
"
]
=
waiting_time
...
@@ -317,14 +319,15 @@ def get_restaurants(db: Session):
...
@@ -317,14 +319,15 @@ def get_restaurants(db: Session):
restaurant
[
"
timeslot
"
]
=
"
-
"
restaurant
[
"
timeslot
"
]
=
"
-
"
if
restaurant
[
"
status
"
]:
if
restaurant
[
"
status
"
]:
waiting_time
=
db
.
query
(
last_record
=
db
.
query
(
models
.
Records
.
waiting_time
models
.
Records
).
filter
(
).
filter
(
models
.
Records
.
place
==
name
models
.
Records
.
place
==
name
).
order_by
(
).
order_by
(
models
.
Records
.
date
.
desc
()
models
.
Records
.
date
.
desc
()
).
first
()
).
first
()
if
waiting_time
:
if
last_record
:
waiting_time
=
last_record
.
waiting_time
restaurant
[
"
waiting_time
"
]
=
round
(
waiting_time
.
total_seconds
()
/
60
)
restaurant
[
"
waiting_time
"
]
=
round
(
waiting_time
.
total_seconds
()
/
60
)
else
:
else
:
restaurant
[
"
waiting_time
"
]
=
None
restaurant
[
"
waiting_time
"
]
=
None
...
...
This diff is collapsed.
Click to expand it.
backend/main.py
+
2
−
2
View file @
72b243de
...
@@ -43,7 +43,7 @@ app.include_router(news.router)
...
@@ -43,7 +43,7 @@ app.include_router(news.router)
@app.get
(
'
/api/records
'
,
response_model
=
List
[
schemas
.
Record
])
@app.get
(
'
/api/records
'
,
response_model
=
List
[
schemas
.
Record
])
async
def
get_records
(
place
:
str
,
db
:
Session
=
Depends
(
get_db
)):
async
def
get_records
(
place
:
str
,
db
:
Session
=
Depends
(
get_db
)):
return
db
.
query
(
models
.
Records
).
filter
(
models
.
Records
==
place
).
order_by
(
models
.
Records
.
date
.
desc
()).
all
()
return
db
.
query
(
models
.
Records
).
filter
(
models
.
Records
.
place
==
place
).
order_by
(
models
.
Records
.
date
.
desc
()).
all
()
@app.post
(
'
/api/records
'
,
response_model
=
schemas
.
Record
)
@app.post
(
'
/api/records
'
,
response_model
=
schemas
.
Record
)
...
@@ -56,7 +56,7 @@ async def stats(record: schemas.RecordBase, db: Session = Depends(get_db)):
...
@@ -56,7 +56,7 @@ async def stats(record: schemas.RecordBase, db: Session = Depends(get_db)):
@app.delete
(
'
/api/records
'
,
response_model
=
None
)
@app.delete
(
'
/api/records
'
,
response_model
=
None
)
async
def
stats
(
id
:
str
,
db
:
Session
=
Depends
(
get_db
)):
async
def
stats
(
id
:
int
,
db
:
Session
=
Depends
(
get_db
)):
if
id
==
0
:
if
id
==
0
:
db
.
query
(
models
.
Records
).
delete
()
db
.
query
(
models
.
Records
).
delete
()
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/WaitingTime.js
+
1
−
1
View file @
72b243de
...
@@ -17,7 +17,7 @@ export default function WaitingTime({ place }) {
...
@@ -17,7 +17,7 @@ export default function WaitingTime({ place }) {
return
(
return
(
<
div
id
=
"
waiting-time-parent
"
>
<
div
id
=
"
waiting-time-parent
"
>
{
data
.
status
?
(
{
data
.
status
?
(
data
.
waiting_time
?
(
data
.
waiting_time
||
data
.
waiting_time
==
0
?
(
<
div
id
=
"
waiting-time-display
"
>
<
div
id
=
"
waiting-time-display
"
>
Le
temps
d
&
apos
;
attente
est
estimé
à
Le
temps
d
&
apos
;
attente
est
estimé
à
<
div
className
=
"
waiting-time-minutes
"
>
<
div
className
=
"
waiting-time-minutes
"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment