Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Nov 23, 2024
1 parent 64fa49d commit ed46984
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dashboard/tabs/gos_student_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def gos_student_tab_ui():
return ui.page_sidebar(
ui.sidebar(
ui.input_text("rfid_input", "RFID", "3325769"),
ui.input_text("rfid_input", "RFID"),
title="ID Number",
),
ui.page_fluid(
Expand Down Expand Up @@ -79,18 +79,24 @@ def hours_per_meeting_plot():

@render.data_frame
def raw_data():
user_data = pd.DataFrame.copy(filter_by_user())
user_data = filter_by_user()
if user_data is None:
return None
user_data = pd.DataFrame.copy(user_data)
user_data["Date In"] = user_data["Date In"].dt.strftime("%Y-%m-%d %H:%M")
user_data["Date Out"] = user_data["Date Out"].dt.strftime("%Y-%m-%d %H:%M")
return render.DataGrid(user_data, filters=True)

@render.text
def days_attended():
user_data = filter_by_user()
if user_data is None:
return "Select Student"
return f"{user_data.count(numeric_only=True)['Hours Attended']}"

@render.text
def hours_logged():
user_data = filter_by_user()
print(user_data.sum(numeric_only=True)['Hours Attended'])
if user_data is None:
return "Select Student"
return f"{user_data.sum(numeric_only=True)['Hours Attended']:.2f}"

0 comments on commit ed46984

Please sign in to comment.