Skip to content

Commit

Permalink
Altera o retorno da grade de programacao quando parametro não é passado
Browse files Browse the repository at this point in the history
  • Loading branch information
nYCSTs committed Nov 26, 2023
1 parent 687fd4c commit 8ec89ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/controller/scheduleController.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from bs4 import BeautifulSoup
from unidecode import unidecode
from starlette.responses import JSONResponse
from datetime import datetime

from utils import enumeration
from constants import errorMessages
Expand All @@ -13,7 +14,7 @@
)

@schedule.get("/")
async def get_schedule_day(day: Optional[str] = None):
async def get_schedule_day(day: Optional[str] = [i.value for i in enumeration.ScheduleDaysEnum][datetime.now().weekday()]):
if day:
day = unidecode(day).upper()
if not enumeration.ScheduleDaysEnum.has_value(day):
Expand All @@ -35,13 +36,9 @@ async def get_schedule_day(day: Optional[str] = None):
cell = row.find_all("td")[0]
schedule_day = unidecode(cell.text.replace("-FEIRA", ""))

if day:
if current_day:
return schedule_data
if day == schedule_day:
current_day = schedule_day
schedule_data[schedule_day] = []
else:
if current_day:
return schedule_data
if day == schedule_day:
current_day = schedule_day
schedule_data[schedule_day] = []
else:
Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
app.include_router(prefix="/api", router=commentController.comment)
app.include_router(prefix="/api", router=scheduleController.schedule)

@app.get("/")
@app.get("/") # pragma: no cover
async def root():
return {"message": "Hello from Video Service"}

Expand Down

0 comments on commit 8ec89ec

Please sign in to comment.