diff --git a/dashboard/tabs/gos_student_tab.py b/dashboard/tabs/gos_student_tab.py index 73a5b4d..2e4caeb 100644 --- a/dashboard/tabs/gos_student_tab.py +++ b/dashboard/tabs/gos_student_tab.py @@ -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( @@ -79,7 +79,10 @@ 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) @@ -87,10 +90,13 @@ def raw_data(): @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}"