Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoutAllaert committed May 23, 2024
1 parent 45e83dc commit f79e1b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Binary file modified .coverage
Binary file not shown.
6 changes: 2 additions & 4 deletions api/models/indiening.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ def save(self, *args, **kwargs):
if "temp" in self.bestand.name:
old_file = self.bestand
old_file_name = old_file.name
new_path = old_file.name.replace(
"temp", f"indiening_{self.indiening_id}"
)
new_path = old_file.name.replace("temp", f"indiening_{self.indiening_id}")
default_storage.save(new_path, ContentFile(old_file.read()))
self.bestand.name = new_path
default_storage.delete(old_file_name)
self.save()


def run_tests_async(instance):
"""
Voert tests uit op een asynchrone manier en werkt de status en het resultaat van de indiening bij.
Expand Down
1 change: 1 addition & 0 deletions api/tests/views/test_gebruiker.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def setUp(self):
self.vak = VakFactory.create()
self.vak.studenten.add(self.gebruiker)
self.vak.save()
self.vak.refresh_from_db()
self.client = APIClient()
self.client.force_login(self.gebruiker.user)
self.url = reverse("gebruiker_detail", kwargs={"id": self.gebruiker.user.id})
Expand Down
6 changes: 4 additions & 2 deletions api/views/groep.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def groep_detail(request, id, format=None):
return Response(serializer.data)

if request.method in ["PUT", "PATCH"]:
if has_permissions(request.user) or validate_new_students(request.user, groep, request.data):
if has_permissions(request.user) or validate_new_students(
request.user, groep, request.data
):
if request.method == "PUT":
serializer = GroepSerializer(groep, data=request.data)
else:
Expand All @@ -99,5 +101,5 @@ def groep_detail(request, id, format=None):

def validate_new_students(user, current_groep, data):
old = set(map(lambda student: student.user.id, current_groep.studenten.all()))
new = set(data.get('studenten'))
new = set(data.get("studenten"))
return (old - new).union(new - old) == {user.id}

0 comments on commit f79e1b7

Please sign in to comment.