Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
condition: service_healthy
restart: true
postgres:
image: "postgres:17"
image: "docker.io/postgres:17"
networks:
- packet-network-dev
environment:
Expand Down
32 changes: 16 additions & 16 deletions packet/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions packet/routes/api.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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'])
Expand Down
2 changes: 1 addition & 1 deletion packet/templates/include/admin/new_packets.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h5 class="modal-title" id="new-packets-modal-label">New Packets</h5>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" class="form-control" placeholder="Date Packets start (MM/DD/YYYY)" id="packet-start-date" required>
<input type="text" class="form-control" placeholder="Date Packets start (MM/DD/YYYY HH [EST])" id="packet-start-date" required>
<input type="file" class="form-control custom-file" id="newPacketsFile" required>
</div>
</div>
Expand Down
10 changes: 4 additions & 6 deletions packet/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(
Expand Down
Loading