diff --git a/advlabdb/assistantModelViews.py b/advlabdb/assistantModelViews.py index cac0866..1fee7c6 100644 --- a/advlabdb/assistantModelViews.py +++ b/advlabdb/assistantModelViews.py @@ -2,7 +2,8 @@ from flask import flash from flask_admin import expose from flask_security import admin_change_password, current_user from wtforms import Form -from wtforms.fields import BooleanField, IntegerField, StringField +from wtforms.fields import TextAreaField +from wtforms.validators import Optional from . import assistantSpace, db from .advlabdb_independent_funs import ( @@ -33,6 +34,39 @@ from .models import ( ) +class AssistantGroupExperimentView(SecureAssistantModelView): + class EditForm(Form): + note = TextAreaField( + "Note", + validators=[Optional()], + description="This note is optional and can be seen and edited by admins and assistants that are responsible for this semester experiment. This note is for information related to the experiment and group. Examples: Protocol received, submission until ..., etc.", + ) + + can_edit = True + column_display_actions = True + + column_list = [ + "semester_experiment.experiment", + "group.number", + "note", + ] + column_labels = { + "semester_experiment.experiment": "Experiment", + "group.number": "Group number", + } + column_formatters = { + "semester_experiment.experiment": str_formatter, + } + + def query_modifier(self, query): + return ( + query.join(SemesterExperiment) + .where(SemesterExperiment.semester == current_user.active_semester) + .join(SemesterExperiment.assistants) + .where(Assistant.user == current_user) + ) + + class AssistantAppointmentView(SecureAssistantModelView): can_edit = True @@ -199,6 +233,11 @@ class AssistantDocsView(SecureAssistantBaseView): return self.render("docs/docs.html", role="assistant") +assistantSpace.add_view( + AssistantGroupExperimentView( + GroupExperiment, db.session, endpoint="assistant_groupexperiment", url="group_experiment" + ) +) assistantSpace.add_view( AssistantAppointmentView(Appointment, db.session, endpoint="assistant_appointment", url="appointment") ) diff --git a/docs/user_docs/assistant.adoc b/docs/user_docs/assistant.adoc index ee38a5e..aea8bae 100644 --- a/docs/user_docs/assistant.adoc +++ b/docs/user_docs/assistant.adoc @@ -9,6 +9,16 @@ In this section, you will find explanations to each menu item on the upper navig === Home This is your home page. Here, you currently only find the number of *missing* final experiment marks for the experiments that you are assigned to. At the latest at the end of the semester, this number should be 0. A number higher than 0 means that some oral and/or protocol marks are missing. The final experiment mark is calculated automatically after the oral and protocol marks of an experiment are set. +=== Group Experiment +Here, you will find all the experiments you are responsible for paired with the groups that are doing these experiments in this semester. You can add an optional note specific to a pair of group and experiment. Examples for such a note: +* Protocol received +* Submission until ... +* etc. + +This note can be **seen and edited** by admins and assistants that are responsible for this semester experiment (if you are not the only one who is responsible for this experiment and group pair). + +To edit the note, click on the pen on the left of a row. + === Appointment Here, you will find all the appointments you have for the experiments you are assigned to. You can only edit the _Date_ of an appointment. You should do so after writing with the students doing the experiment corresponding to the appointment. The initial date you find before editing it is only a suggestion in the week where the appointment should take place. If _Special_ is checked, then the date should be chosen in the semester break.