diff --git a/docker-compose.yml b/docker-compose.yml index 4b06ce6..dc452c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: condition: service_healthy restart: true postgres: - image: "postgres:17" + image: "docker.io/postgres:17" networks: - packet-network-dev environment: diff --git a/packet/commands.py b/packet/commands.py index 31f9590..a1e0754 100644 --- a/packet/commands.py +++ b/packet/commands.py @@ -65,22 +65,22 @@ def sync_freshmen(freshmen_csv: str) -> None: sync_freshman(freshmen_in_csv) print('Done!') - -@app.cli.command('create-packets') -@click.argument('freshmen_csv') -def create_packets(freshmen_csv: str) -> None: - """ - Creates a new packet season for each of the freshmen in the given CSV. - """ - print("WARNING: The 'sync-freshmen' command must be run first to ensure that the state of floor is up to date.") - if input('Continue? (y/N): ').lower() != 'y': - return - - # Collect the necessary data - base_date = input_date('Input the first day of packet season') - freshmen_in_csv = parse_csv(freshmen_csv) - create_new_packets(base_date, freshmen_in_csv) - print('Done!') +# TODO: this needs fixed with a proper datetime +# @app.cli.command('create-packets') +# @click.argument('freshmen_csv') +# def create_packets(freshmen_csv: str) -> None: +# """ +# Creates a new packet season for each of the freshmen in the given CSV. +# """ +# print("WARNING: The 'sync-freshmen' command must be run first to ensure that the state of floor is up to date.") +# if input('Continue? (y/N): ').lower() != 'y': +# return + +# # Collect the necessary data +# base_date = input_date('Input the first day of packet season') +# freshmen_in_csv = parse_csv(freshmen_csv) +# create_new_packets(base_date, freshmen_in_csv) +# print('Done!') @app.cli.command('ldap-sync') diff --git a/packet/routes/api.py b/packet/routes/api.py index 5e14eef..d991dfe 100644 --- a/packet/routes/api.py +++ b/packet/routes/api.py @@ -1,7 +1,7 @@ """ Shared API endpoints """ -from datetime import datetime, date +from datetime import datetime from json import dumps from typing import Dict, Any, Union, Tuple @@ -76,7 +76,7 @@ def create_packet() -> Tuple[str, int]: if not ldap.is_evals(ldap.get_member(username)): return 'Forbidden: not Evaluations Director', 403 - base_date: date = datetime.strptime(request.json['start_date'], '%m/%d/%Y').date() + base_date: datetime = datetime.strptime(request.json['start_date'], '%m/%d/%Y %H') freshmen_in_post: Dict[str, POSTFreshman] = { freshman.rit_username: freshman for freshman in map(POSTFreshman, request.json['freshmen']) diff --git a/packet/templates/include/admin/new_packets.html b/packet/templates/include/admin/new_packets.html index c6dd307..c312f65 100644 --- a/packet/templates/include/admin/new_packets.html +++ b/packet/templates/include/admin/new_packets.html @@ -10,7 +10,7 @@ diff --git a/packet/utils.py b/packet/utils.py index 26f5fe6..496bf5c 100644 --- a/packet/utils.py +++ b/packet/utils.py @@ -1,7 +1,7 @@ """ General utilities and decorators for supporting the Python logic """ -from datetime import datetime, time, timedelta, date +from datetime import datetime, timedelta from functools import wraps, lru_cache from typing import Any, Callable, TypeVar, cast from urllib.parse import urlparse @@ -161,11 +161,9 @@ def sync_freshman(freshmen_list: dict) -> None: db.session.commit() -def create_new_packets(base_date: date, freshmen_list: dict) -> None: - packet_start_time = time(hour=19) - packet_end_time = time(hour=21) - start = datetime.combine(base_date, packet_start_time) - end = datetime.combine(base_date, packet_end_time) + timedelta(days=14) +def create_new_packets(base_date: datetime, freshmen_list: dict) -> None: + start = base_date + end = base_date + timedelta(days=14) app.logger.info('Fetching data from LDAP...') all_upper = list(filter(