Skip to content

Commit

Permalink
Merge pull request #138 from cuappdev/master
Browse files Browse the repository at this point in the history
Merge `master` to `release`
  • Loading branch information
vinnie4k authored Jan 21, 2024
2 parents 8e4ee9e + 81e6015 commit 5e964cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def shutdown_session(exception=None):
def scrape_hours():
logging.info("Scraping hours from sheets...")

clean_past_hours()
fetch_reg_facility()
fetch_reg_building()
fetch_sp_facility()
clean_past_hours()


# Scrape capacities every 10 minutes
Expand Down
2 changes: 2 additions & 0 deletions src/scrapers/scraper_helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytz
from collections import namedtuple
from datetime import datetime, timedelta, timezone
from src.database import db_session
from src.models.openhours import OpenHours
from src.utils.constants import (
EASTERN_TIMEZONE,
Expand All @@ -21,6 +22,7 @@ def clean_past_hours():
"""
day_unix = unix_time(datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)) - SECONDS_IN_DAY
OpenHours.query.filter(OpenHours.end_time <= day_unix).delete()
db_session.commit()


def clean_hours(date, facility_id=None, gym_id=None):
Expand Down

0 comments on commit 5e964cd

Please sign in to comment.