Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard overhaul #186

Merged
merged 23 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ef30679
orbit/nginx snippets: rename dashboard to activity log
charliemirabile Sep 5, 2024
08b4163
radius: clean up dashboard inline html
michael-burke4 Jul 30, 2024
135bc18
orbit/container-compose: denis db visible to orbit
michael-burke4 Aug 2, 2024
2d0a590
radius: Add new course dashboard
michael-burke4 Aug 2, 2024
0217a6b
orbit: wire up oopsie buttons to submit form with post request
charliemirabile Sep 6, 2024
bf37d68
orbit: radius: dashboard: confirm before oopsie
charliemirabile Oct 14, 2024
200e6f8
orbit db: add oopsie table
michael-burke4 Sep 11, 2024
ed8dcd4
orbit: radius: dashboard: save oopsies in table
charliemirabile Sep 10, 2024
9fe4ad6
radius: factor out oopsie button into its own function
charliemirabile Oct 14, 2024
0e1283b
radius: Make oopsie button reflect oopsie status
michael-burke4 Sep 17, 2024
1d7caf4
radius: create assignment table scaffolding
charliemirabile Oct 14, 2024
0ff5e77
radius: factor main table row into body function
charliemirabile Oct 14, 2024
158a5d4
orbit: add rows for the remaining submission components
charliemirabile Oct 14, 2024
b6c0162
orbit: conditional assignment table body
charliemirabile Oct 14, 2024
3b4f357
mailman: add gradeable table to mailman db
michael-burke4 Sep 19, 2024
341edee
mailman: add status to submission table
michael-burke4 Sep 23, 2024
5a4f913
mailman: mark all submissions as 'unrecognized'
michael-burke4 Sep 23, 2024
8e29cb5
mailman: record initial and final subs in gradeable
michael-burke4 Sep 22, 2024
edeac78
mailman: record peer reviews in gradeable db
michael-burke4 Sep 22, 2024
ceb37cb
orbit: assignment table indicates assigned reviewees
michael-burke4 Sep 23, 2024
7755dc0
radius: replace placeholders in table with submission info
michael-burke4 Sep 24, 2024
4a00af8
radius: display assignment info
michael-burke4 Sep 24, 2024
8341650
radius: hide rows in table until deadline passes
charliemirabile Oct 14, 2024
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
5 changes: 5 additions & 0 deletions container-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ services:
additional_contexts:
- orbit_docs_source=./docs
- mailman_source=./mailman
- denis_source=./denis
target: orbit
args:
orbit_version_info: "singularity ${SINGULARITY_VERSION} ${SINGULARITY_DEPLOYMENT_STATUS} https://github.com/underground-software/singularity"
Expand All @@ -55,6 +56,10 @@ services:
source: submissions-db
target: /var/lib/mailman
read_only: true
- type: volume
source: denis-db
target: /var/lib/denis
read_only: true
- type: volume
source: git-repos
target: /var/lib/git
Expand Down
9 changes: 9 additions & 0 deletions mailman/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ class Submission(BaseModel):
recipient = peewee.TextField()
email_count = peewee.IntegerField()
in_reply_to = peewee.TextField(null=True)
status = peewee.TextField(null=True)


class Gradeable(BaseModel):
submission_id = peewee.TextField(unique=True)
timestamp = peewee.IntegerField()
user = peewee.TextField()
assignment = peewee.TextField()
component = peewee.TextField()


if __name__ == '__main__':
Expand Down
54 changes: 51 additions & 3 deletions mailman/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys

import db
import denis.db


Email = collections.namedtuple('Email', ['rcpt', 'msg_id'])
Expand All @@ -22,6 +23,7 @@ def main(argv):
with open(Path(logdir) / logfile) as log:
header, *email_lines = log.readlines()
timestamp, user = header.split()
timestamp = int(timestamp)

emails = [email_from_log_line(line) for line in email_lines]

Expand All @@ -46,9 +48,55 @@ def main(argv):
reply_id = reply_email_id[:-4] + '0000'
break

db.Submission.create(submission_id=logfile, timestamp=timestamp,
user=user, recipient=emails[0].rcpt,
email_count=len(emails), in_reply_to=reply_id)
sub = db.Submission(submission_id=logfile, timestamp=timestamp,
user=user, recipient=emails[0].rcpt,
email_count=len(emails), in_reply_to=reply_id)

def set_status(status):
sub.status = status
sub.save()
return 0

asn_db = denis.db.Assignment
gr_db = db.Gradeable
if asn := asn_db.get_or_none(asn_db.name == emails[0].rcpt):
if len(emails) < 2:
return set_status('missing patches')
typ = ('initial' if timestamp < asn.initial_due_date
else 'final' if timestamp < asn.final_due_date else None)
if not typ:
return set_status(f'{asn.name} past due')
gr_db.create(submission_id=logfile, timestamp=timestamp, user=user,
assignment=asn.name, component=typ)
return set_status(f'{asn.name}: {typ}')

if reply_id:
if not (orig := gr_db.get_or_none(gr_db.submission_id == reply_id)):
return set_status('not a reply to a submission')
asn_name = orig.assignment
asn = asn_db.get_or_none(asn_name == asn_db.name)
if not asn:
raise RuntimeError('invalid assignment name in gradeable DB')
if timestamp > asn.peer_review_due_date:
return set_status(f'{asn.name} review past due')
rev_db = denis.db.PeerReviewAssignment
rev = rev_db.get_or_none((rev_db.assignment == asn_name) &
(rev_db.reviewer == user))
if not rev:
return set_status('ineligible for peer review')
match emails[0].rcpt:
case rev.reviewee1:
typ = 'review1'
case rev.reviewee2:
typ = 'review2'
case _:
return set_status('reviewed wrong submission')
gr_db.create(submission_id=logfile, timestamp=timestamp,
user=user, assignment=asn_name, component=typ,
comments=None)
return set_status(f'{asn_name}: {typ}')

return set_status('Not a recognized recipient')


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion nginx_snippets/server_https/00-orbit-paths.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ location @login {
return 303 /login?target=$uri;
}

location ~* ^((.*\.md)|/log(in|out)|/dashboard|/register|/cgit.*)$ {
location ~* ^((.*\.md)|/log(in|out)|/activity|/dashboard|/register|/cgit.*)$ {
include uwsgi_params;
proxy_intercept_errors on;
proxy_pass http://orbit:9098;
Expand Down
1 change: 1 addition & 0 deletions orbit/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ WORKDIR /usr/local/share/orbit
COPY --from=build /usr/local/share/orbit /usr/local/share/orbit
COPY --from=orbit_docs_source . ./docs
COPY --from=mailman_source . ./mailman
COPY --from=denis_source . ./denis

RUN mkdir -p /var/lib/orbit/ && \
./db.py \
Expand Down
6 changes: 6 additions & 0 deletions orbit/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ class Session(BaseModel):
expiry = peewee.FloatField()


class Oopsie(BaseModel):
user = peewee.TextField(primary_key=True)
assignment = peewee.TextField()
timestamp = peewee.IntegerField()


if __name__ == '__main__':
DB.create_tables(BaseModel.__subclasses__())
3 changes: 2 additions & 1 deletion orbit/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ <h1 class="title" >Kernel Development Learning Pipeline</h1>
<div class="nav">
<a class="nav" href="/index.md">Home</a>
<a class="nav" href="/cgit">Git</a>
<a class="nav" href="/dashboard">Dashboard</a>
<a class="nav" href="/dashboard">Course Dashboard</a>
<a class="nav" href="/activity">Activity Log</a>
<a class="nav" href="/login">Login</a>
</div>
<hr>
Loading