Skip to content

Commit 08cc65c

Browse files
authored
Merge pull request #383 from ComputerScienceHouse/develop
Packet time is schedulable
2 parents 3a6eced + e2f7f07 commit 08cc65c

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
condition: service_healthy
2525
restart: true
2626
postgres:
27-
image: "postgres:17"
27+
image: "docker.io/postgres:17"
2828
networks:
2929
- packet-network-dev
3030
environment:

packet/commands.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from . import app, db
1313
from .models import Packet, FreshSignature, UpperSignature, MiscSignature
14-
from .utils import sync_freshman, create_new_packets, sync_with_ldap
14+
from .utils import sync_freshman, sync_with_ldap
1515

1616

1717
@app.cli.command('create-secret')
@@ -65,22 +65,22 @@ def sync_freshmen(freshmen_csv: str) -> None:
6565
sync_freshman(freshmen_in_csv)
6666
print('Done!')
6767

68-
69-
@app.cli.command('create-packets')
70-
@click.argument('freshmen_csv')
71-
def create_packets(freshmen_csv: str) -> None:
72-
"""
73-
Creates a new packet season for each of the freshmen in the given CSV.
74-
"""
75-
print("WARNING: The 'sync-freshmen' command must be run first to ensure that the state of floor is up to date.")
76-
if input('Continue? (y/N): ').lower() != 'y':
77-
return
78-
79-
# Collect the necessary data
80-
base_date = input_date('Input the first day of packet season')
81-
freshmen_in_csv = parse_csv(freshmen_csv)
82-
create_new_packets(base_date, freshmen_in_csv)
83-
print('Done!')
68+
# TODO: this needs fixed with a proper datetime
69+
# @app.cli.command('create-packets')
70+
# @click.argument('freshmen_csv')
71+
# def create_packets(freshmen_csv: str) -> None:
72+
# """
73+
# Creates a new packet season for each of the freshmen in the given CSV.
74+
# """
75+
# print("WARNING: The 'sync-freshmen' command must be run first to ensure that the state of floor is up to date.")
76+
# if input('Continue? (y/N): ').lower() != 'y':
77+
# return
78+
79+
# # Collect the necessary data
80+
# base_date = input_date('Input the first day of packet season')
81+
# freshmen_in_csv = parse_csv(freshmen_csv)
82+
# create_new_packets(base_date, freshmen_in_csv)
83+
# print('Done!')
8484

8585

8686
@app.cli.command('ldap-sync')

packet/routes/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Shared API endpoints
33
"""
4-
from datetime import datetime, date
4+
from datetime import datetime
55
from json import dumps
66
from typing import Dict, Any, Union, Tuple
77

@@ -76,7 +76,7 @@ def create_packet() -> Tuple[str, int]:
7676
if not ldap.is_evals(ldap.get_member(username)):
7777
return 'Forbidden: not Evaluations Director', 403
7878

79-
base_date: date = datetime.strptime(request.json['start_date'], '%m/%d/%Y').date()
79+
base_date: datetime = datetime.strptime(request.json['start_date'], '%m/%d/%Y %H')
8080

8181
freshmen_in_post: Dict[str, POSTFreshman] = {
8282
freshman.rit_username: freshman for freshman in map(POSTFreshman, request.json['freshmen'])

packet/templates/include/admin/new_packets.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h5 class="modal-title" id="new-packets-modal-label">New Packets</h5>
1010
</div>
1111
<div class="modal-body">
1212
<div class="form-group">
13-
<input type="text" class="form-control" placeholder="Date Packets start (MM/DD/YYYY)" id="packet-start-date" required>
13+
<input type="text" class="form-control" placeholder="Date Packets start (MM/DD/YYYY HH [EST])" id="packet-start-date" required>
1414
<input type="file" class="form-control custom-file" id="newPacketsFile" required>
1515
</div>
1616
</div>

packet/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
General utilities and decorators for supporting the Python logic
33
"""
4-
from datetime import datetime, time, timedelta, date
4+
from datetime import datetime, timedelta
55
from functools import wraps, lru_cache
66
from typing import Any, Callable, TypeVar, cast
77
from urllib.parse import urlparse
@@ -161,11 +161,9 @@ def sync_freshman(freshmen_list: dict) -> None:
161161
db.session.commit()
162162

163163

164-
def create_new_packets(base_date: date, freshmen_list: dict) -> None:
165-
packet_start_time = time(hour=19)
166-
packet_end_time = time(hour=21)
167-
start = datetime.combine(base_date, packet_start_time)
168-
end = datetime.combine(base_date, packet_end_time) + timedelta(days=14)
164+
def create_new_packets(base_date: datetime, freshmen_list: dict) -> None:
165+
start = base_date
166+
end = base_date + timedelta(days=14)
169167

170168
app.logger.info('Fetching data from LDAP...')
171169
all_upper = list(filter(

0 commit comments

Comments
 (0)