1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-30 17:33:51 +00:00

Remove unneeded filters

This commit is contained in:
Mo 2022-06-30 04:21:38 +02:00
parent 8c439ab530
commit 3f6e86dae1

View file

@ -1065,16 +1065,6 @@ class AppointmentView(SecureAdminModelView):
class ExperimentMarkView(SecureAdminModelView):
class StudentFilter(FilterEqual):
def validate(self, value):
if db.session.get(Student, value) is not None:
return True
else:
return False
def apply(self, query, value, alias=None):
return query.join(PartStudent).where(PartStudent.student_id == int(value))
class AssistantFilter(AssistantRowFilter):
def apply(self, query, value, alias=None):
return query.where(ExperimentMark.assistant_id == int(value))
@ -1109,12 +1099,6 @@ class ExperimentMarkView(SecureAdminModelView):
def apply(self, query, value, alias=None):
return query.join(PartStudent).where(PartStudent.part_id == int(value))
class SemesterFilter(SemesterRowFilter):
def apply(self, query, value, alias=None):
return (
query.join(GroupExperiment).join(SemesterExperiment).where(SemesterExperiment.semester_id == int(value))
)
class CreateForm(FlaskForm):
part_student = QuerySelectField(
"Part Student",
@ -1144,8 +1128,6 @@ class ExperimentMarkView(SecureAdminModelView):
}
column_filters = (
StudentFilter(ExperimentMark, "Student / ID"),
SemesterFilter(ExperimentMark, "Semester"),
AssistantFilter(ExperimentMark, "Assistant"),
AdminFilter(ExperimentMark, "Admin"),
ExperimentFilter(ExperimentMark, "Experiment"),