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: 2 additions & 0 deletions container-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ services:
- journal_source=./journal
- mailman_source=./mailman
- orbit_source=./orbit
environment:
TZ: ${SINGULARITY_TIMEZONE}
volumes:
- type: volume
source: denis-db
Expand Down
1 change: 1 addition & 0 deletions denis/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FROM alpine:3.20 AS denis
RUN apk add \
py3-peewee \
py3-gitpython \
tzdata \
;

WORKDIR /usr/local/share/denis
Expand Down
20 changes: 15 additions & 5 deletions denis/configure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

from datetime import datetime
from argparse import ArgumentParser as ap

import db
Expand Down Expand Up @@ -48,7 +49,12 @@ def add_final(parser, required=True):
remove_parser = command_parsers.add_parser('remove')
add_assignment(remove_parser)

command_parsers.add_parser('dump')
dump_parser = command_parsers.add_parser('dump')
dump_parser.add_argument('-i', '--iso',
action='store_true',
dest='fmt_iso',
help='Dump dates in ISO format')

command_parsers.add_parser('reload')

# Dictionary containing the desired command and all flags with their values
Expand Down Expand Up @@ -96,13 +102,17 @@ def remove(assignment):
print(f'no such assignment {assignment}')


def dump():
def dump(fmt_iso):
def timestamp_to_formatted(timestamp):
dt = datetime.fromtimestamp(timestamp).astimezone()
return dt.isoformat() if fmt_iso else dt.strftime('%a %b %d %Y %T %Z (%z)')

print(' --- Assignments ---')
for asn in db.Assignment.select():
print(f'''{asn.name}:
\tInitial: {asn.initial_due_date}
\tPeer Review: {asn.peer_review_due_date}
\tFinal: {asn.final_due_date}''')
\tInitial:\t{timestamp_to_formatted(asn.initial_due_date)}
\tPeer Review:\t{timestamp_to_formatted(asn.peer_review_due_date)}
\tFinal:\t\t{timestamp_to_formatted(asn.final_due_date)}''')
Comment thread
charliemirabile marked this conversation as resolved.


def reload():
Expand Down