mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-10-11 19:54:21 +00:00
Apply ruff lints
This commit is contained in:
parent
726d73211b
commit
0371cbf688
8 changed files with 16 additions and 17 deletions
|
@ -36,9 +36,9 @@ def deactivate_assistants():
|
|||
user_ids_to_deactivate = db.session.scalars(
|
||||
select(Assistant.user_id)
|
||||
.join(User)
|
||||
.where(User.active == True)
|
||||
.where(User.active is True)
|
||||
.except_(
|
||||
select(Assistant.user_id).join(Assistant.semester_experiments).join(Semester).where(Semester.done == False)
|
||||
select(Assistant.user_id).join(Assistant.semester_experiments).join(Semester).where(Semester.done is False)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -632,14 +632,14 @@ class GroupView(SecureAdminModelView):
|
|||
if is_created:
|
||||
|
||||
def query_factory():
|
||||
return partStudentQueryFactory().where(PartStudent.group == None)
|
||||
return partStudentQueryFactory().where(PartStudent.group is None)
|
||||
|
||||
else:
|
||||
|
||||
def query_factory():
|
||||
return partStudentQueryFactory().where(
|
||||
or_(
|
||||
and_(PartStudent.group == None, Part.program == group.program),
|
||||
and_(PartStudent.group is None, Part.program == group.program),
|
||||
PartStudent.group == group,
|
||||
)
|
||||
)
|
||||
|
@ -749,7 +749,7 @@ class ExperimentView(SecureAdminModelView):
|
|||
|
||||
|
||||
def assistantQueryFactory():
|
||||
return Assistant.query.join(User).where(User.active == True)
|
||||
return Assistant.query.join(User).where(User.active is True)
|
||||
|
||||
|
||||
def weighting_field(label: str, default: float):
|
||||
|
@ -771,7 +771,7 @@ class SemesterExperimentView(SecureAdminModelView):
|
|||
class CreateForm(FlaskForm):
|
||||
@staticmethod
|
||||
def experimentQueryFactory():
|
||||
return Experiment.query.where(Experiment.active == True)
|
||||
return Experiment.query.where(Experiment.active is True)
|
||||
|
||||
experiment = QuerySelectField(
|
||||
"Experiment",
|
||||
|
@ -932,7 +932,7 @@ class ExperimentRowFilter(FilterEqual):
|
|||
if not has_request_context():
|
||||
return tuple()
|
||||
|
||||
activeExperiments = db.session.scalars(select(Experiment).where(Experiment.active == True))
|
||||
activeExperiments = db.session.scalars(select(Experiment).where(Experiment.active is True))
|
||||
return tuple(
|
||||
(
|
||||
f"{activeExperiment.number},{activeExperiment.program_id}",
|
||||
|
@ -1189,7 +1189,7 @@ class ExperimentMarkView(SecureAdminModelView):
|
|||
if not has_request_context():
|
||||
return tuple()
|
||||
|
||||
admins = db.session.scalars(select(Admin).join(User).where(User.active == True))
|
||||
admins = db.session.scalars(select(Admin).join(User).where(User.active is True))
|
||||
return tuple((admin.id, str(admin)) for admin in admins)
|
||||
|
||||
def apply(self, query, value, alias=None):
|
||||
|
|
|
@ -76,7 +76,7 @@ def mark_hists(markType, active_assistants):
|
|||
|
||||
|
||||
def assistant_marks_analysis(cls):
|
||||
active_assistants = db.session.scalars(select(Assistant).join(User).where(User.active == True)).all()
|
||||
active_assistants = db.session.scalars(select(Assistant).join(User).where(User.active is True)).all()
|
||||
|
||||
oral_mark_hists = mark_hists("Oral", active_assistants)
|
||||
protocol_mark_hists = mark_hists("Protocol", active_assistants)
|
||||
|
|
|
@ -211,7 +211,7 @@ class AssistantUserView(SecureAssistantModelView):
|
|||
@staticmethod
|
||||
def semesterQueryFactory():
|
||||
# Show only last two semesters to assistants
|
||||
return Semester.query.order_by(Semester.id.desc()).where(Semester.done == False).limit(2)
|
||||
return Semester.query.order_by(Semester.id.desc()).where(Semester.done is False).limit(2)
|
||||
|
||||
active_semester = QuerySelectField(
|
||||
"Active Semester",
|
||||
|
|
|
@ -44,9 +44,9 @@ class SecureAdminIndexView(CustomIndexView):
|
|||
.join(Assistant.semester_experiments)
|
||||
.where(SemesterExperiment.semester == current_user.active_semester)
|
||||
.join(SemesterExperiment.group_experiments)
|
||||
.where(GroupExperiment.experiment_marks_missing == True)
|
||||
.where(GroupExperiment.experiment_marks_missing is True)
|
||||
.join(GroupExperiment.experiment_marks)
|
||||
.where(ExperimentMark.final_experiment_mark == None)
|
||||
.where(ExperimentMark.final_experiment_mark is None)
|
||||
.group_by(Assistant.id)
|
||||
.order_by(func.count().desc())
|
||||
)
|
||||
|
@ -71,7 +71,7 @@ class SecureAssistantIndexView(CustomIndexView):
|
|||
.where(SemesterExperiment.semester == current_user.active_semester)
|
||||
.join(SemesterExperiment.assistants)
|
||||
.where(Assistant.user == current_user)
|
||||
.where(ExperimentMark.final_experiment_mark == None)
|
||||
.where(ExperimentMark.final_experiment_mark is None)
|
||||
)
|
||||
|
||||
return self.render(
|
||||
|
|
|
@ -4,7 +4,6 @@ from pathlib import Path
|
|||
from flask import flash
|
||||
from sqlalchemy import select
|
||||
|
||||
from . import data_dir
|
||||
from .exceptions import DatabaseImportException
|
||||
from .actions import backup
|
||||
from .models import (
|
||||
|
|
|
@ -542,7 +542,7 @@ class Semester(db.Model):
|
|||
if transferParts:
|
||||
semester.transferPartsFrom(oldSemester)
|
||||
|
||||
for experiment in db.session.scalars(select(Experiment).where(Experiment.active == True)):
|
||||
for experiment in db.session.scalars(select(Experiment).where(Experiment.active is True)):
|
||||
newSemesterExperiment = SemesterExperiment(experiment=experiment, semester=semester)
|
||||
|
||||
if transferAssistants:
|
||||
|
@ -580,7 +580,7 @@ class Semester(db.Model):
|
|||
.join(GroupExperiment)
|
||||
.join(SemesterExperiment)
|
||||
.where(SemesterExperiment.semester == self)
|
||||
.where(ExperimentMark.final_experiment_mark == None)
|
||||
.where(ExperimentMark.final_experiment_mark is None)
|
||||
)
|
||||
|
||||
def set_done(self, next_semester=None):
|
||||
|
|
|
@ -14,7 +14,7 @@ def _reset_admin_password(manage):
|
|||
|
||||
with app.app_context():
|
||||
with db.session.begin():
|
||||
admins = db.session.scalars(select(Admin).join(User).where(User.active == True)).all()
|
||||
admins = db.session.scalars(select(Admin).join(User).where(User.active is True)).all()
|
||||
activate_user = False
|
||||
|
||||
if len(admins) == 0:
|
||||
|
|
Loading…
Reference in a new issue