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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
radius: Make oopsie button reflect oopsie status
Determine 'oopsieness' and store that value in each assignment table.
This value is used to change how the oopsie button is generated.
  • Loading branch information
michael-burke4 authored and charliemirabile committed Oct 14, 2024
commit 0e1283b7d071c5ac84e53e4ea09455a3bb68079b
47 changes: 43 additions & 4 deletions orbit/radius.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,39 @@ def submission_fields(sub):
""")


class OopsStatus:
PAST_DUE = 0
AVAILABLE = 1
USED_HERE = 2
UNAVAILABLE = 3


class AsmtTable:
def __init__(self, assignment):
def __init__(self, assignment, oopsieness):
self.assignment = assignment
self.name = assignment.name
self.oopsieness = oopsieness

def oops_button_hover(self):
match self.oopsieness:
case OopsStatus.PAST_DUE:
return (f"Too late to oopsie! {self.name} "
"initial submission is past due!")
case OopsStatus.AVAILABLE:
return f"Click to use your oopsie on {self.name}"
case OopsStatus.USED_HERE:
return "Oopsie used here!"
case OopsStatus.UNAVAILABLE:
return "You have already used your oopsie"

def oopsie_button(self):
return f'''<button type="submit" name="oopsie"
value="{self.name}">Oopsie!</button>'''
return f"""
<button {'disabled' if self.oopsieness != OopsStatus.AVAILABLE else ''}
title='{self.oops_button_hover()}' type="submit" name="oopsie"
value="{self.name}">
Oopsie!
</button>
"""

def __str__(self):
return f"""
Expand All @@ -436,6 +461,16 @@ def __str__(self):
"""


def get_asmt_oopsieness(oops, cur_assignment, initial_due):
if oops and oops.assignment == cur_assignment:
return OopsStatus.USED_HERE
if initial_due < int(datetime.now().timestamp()):
return OopsStatus.PAST_DUE
if oops:
return OopsStatus.UNAVAILABLE
return OopsStatus.AVAILABLE


def handle_dashboard(rocket):
if not rocket.session:
return rocket.raw_respond(HTTPStatus.FORBIDDEN)
Expand Down Expand Up @@ -464,10 +499,14 @@ def handle_dashboard(rocket):
timestamp=int(now))
except db.peewee.IntegrityError:
return rocket.raw_respond(HTTPStatus.BAD_REQUEST)
oops_tbl = db.Oopsie
oops = oops_tbl.get_or_none(oops_tbl.user == rocket.session.username)
assignments = asmt_tbl.select().order_by(asmt_tbl.initial_due_date)
ret = '<form method="post" action="/dashboard">'
for assignment in assignments:
ret += str(AsmtTable(assignment))
oopsieness = get_asmt_oopsieness(oops, assignment.name,
assignment.initial_due_date)
ret += str(AsmtTable(assignment, oopsieness))
return rocket.respond(ret + '</form>')


Expand Down