Skip to content

Commit

Permalink
Merge master to release (#129)
Browse files Browse the repository at this point in the history
* Fixed weekday alignment issues (#127)

* Add logger info (#128)

* Fixed weekday alignment issues

* Fixed override issue
  • Loading branch information
vinnie4k authored Jan 7, 2024
1 parent ddbb160 commit eedfc54
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9
ENV TZ="America/New_York"
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
Expand Down
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
scheduler.init_app(app)
scheduler.start()

# Logging
logging.basicConfig(format="%(asctime)s %(levelname)-8s %(message)s", level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S")


@app.route("/")
def index():
Expand Down
10 changes: 5 additions & 5 deletions src/scrapers/reg_hours_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def fetch_reg_building():
date = datetime.now() + timedelta(days=i)

# Get spreadsheet info
weekday = DAYS_OF_WEEK[i]
weekday = DAYS_OF_WEEK[date.weekday()]
names = vals["Name"]

# Add to database
Expand Down Expand Up @@ -86,7 +86,7 @@ def fetch_reg_bowling(vals):
date = datetime.now() + timedelta(days=i)

# Get spreadsheet info
weekday = DAYS_OF_WEEK[i]
weekday = DAYS_OF_WEEK[date.weekday()]
names = vals["Name"]

# Add to database
Expand Down Expand Up @@ -121,7 +121,7 @@ def fetch_reg_court(vals):
date = datetime.now() + timedelta(days=i)

# Get spreadsheet info
weekday = DAYS_OF_WEEK[i]
weekday = DAYS_OF_WEEK[date.weekday()]
names = vals["Name"]

# Add to database
Expand Down Expand Up @@ -156,7 +156,7 @@ def fetch_reg_pool(vals):
date = datetime.now() + timedelta(days=i)

# Get spreadsheet info
weekday = DAYS_OF_WEEK[i]
weekday = DAYS_OF_WEEK[date.weekday()]
names = vals["Name"]

# Add to database
Expand Down Expand Up @@ -196,7 +196,7 @@ def fetch_reg_fc(vals):
date = datetime.now() + timedelta(days=i)

# Get spreadsheet info
weekday = DAYS_OF_WEEK[i]
weekday = DAYS_OF_WEEK[date.weekday()]
names = vals["Name"]

# Add to database
Expand Down
9 changes: 3 additions & 6 deletions src/scrapers/sp_hours_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def fetch_sp_facility():

# Check if hours exist and is within next 7 days
if hours and within_week(date):
if hours == MARKER_CLOSED:
clean_hours(date, get_facility_id(name))
else:
# Clean hours from database
clean_hours(date, get_facility_id(name))
if hours != MARKER_CLOSED:
parse_special_hours(hours, type, date, get_facility_id(name))


Expand Down Expand Up @@ -101,9 +101,6 @@ def add_special_facility_hours(start_time, end_time, facility_id, court_type=Non
start_unix = unix_time(start_time)
end_unix = unix_time(end_time)

# Clean hours from database
clean_hours(start_time, facility_id)

# Create hours
hrs = OpenHours(
end_time=end_unix,
Expand Down

0 comments on commit eedfc54

Please sign in to comment.