Fakultas Ilmu Komputer UI

Commit 00c4403a authored by Muh Riansyah Tohamba's avatar Muh Riansyah Tohamba 💬
Browse files

Merge branch '1806280520-245' into 'master'

Replace Magic Number with Symbolic Constant on Model Class Application

See merge request !294
parents 45164e21 b047f62e
Pipeline #26930 passed with stages
in 14 minutes and 11 seconds
......@@ -30,13 +30,13 @@ class StudentSerializer(serializers.ModelSerializer):
def get_accepted_no(obj):
apps = Application.objects.filter(student=obj, status=4)
apps = Application.objects.filter(student=obj, status=Application.ACCEPTED)
companies = apps.values('vacancy__company').distinct()
return companies.count()
def get_read_no(obj):
apps = Application.objects.filter(student=obj, status=1)
apps = Application.objects.filter(student=obj, status=Application.READ)
companies = apps.values('vacancy__company').distinct()
return companies.count()
......@@ -12,7 +12,7 @@ class VacancySerializer(serializers.ModelSerializer):
total_accepted_applicants = serializers.SerializerMethodField('_get_total_accepted_applicants')
def _get_total_accepted_applicants(self, instance):
return len(Application.objects.filter(vacancy=instance, status=4))
return len(Application.objects.filter(vacancy=instance, status=Application.ACCEPTED))
def _get_app_status(self, instance):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment