Skip to content

Commit

Permalink
fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanuj22 committed Feb 11, 2020
1 parent 22e6799 commit 47ea19c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/core/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from rest_framework import serializers

from core.models import Course, Feedback, Assignment
Expand Down Expand Up @@ -76,5 +77,5 @@ class Meta:
fields = ['id', 'roll_no', 'availability', 'name', 'program']

def get_availability(self, instance):
return 8 - instance.assignment_set.filter(is_active=True).aggregate(
Sum('assigned_hours'))['assigned_hours__sum']
return settings.MAX_TA_HOURS - instance.assignment_set.filter(is_active=True).aggregate(
Sum('assigned_hours'))['assigned_hours__sum']
8 changes: 4 additions & 4 deletions src/core/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ def get_queryset(self, queryset=None):
if self.action == 'past':
return self.queryset.filter(
assignment__teaching_assistant__user=self.request.user).exclude(
date_submitted__month=today.month)
date_submitted__month=today.month, date_submitted__year=today.year)
elif self.action == 'current':
return self.queryset.filter(
assignment__teaching_assistant__user=self.request.user,
date_submitted__month=today.month)
date_submitted__month=today.month, date_submitted__year=today.year)
elif self.action == 'submit':
return Assignment.objects.filter(
teaching_assistant__user=self.request.user
).exclude(id__in=Feedback.objects.filter(
assignment__teaching_assistant__user=self.request.user,
date_submitted__month=today.month).values_list('assignment'))
date_submitted__month=today.month, date_submitted__year=today.year).values_list('assignment'))
elif self.action == 'approval_current':
return self.queryset.filter(
assignment__course__supervisor__user=self.request.user,
date_submitted__month=today.month,
date_submitted__month=today.month, date_submitted__year=today.year,
status="1"
)
else:
Expand Down
2 changes: 2 additions & 0 deletions src/ta_portal/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,5 @@
)

SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['username', 'first_name', 'last_name', 'email']

MAX_TA_HOURS = 8

0 comments on commit 47ea19c

Please sign in to comment.