Fakultas Ilmu Komputer UI

Commit 87f22a4c authored by Reza Qorib's avatar Reza Qorib
Browse files

Merge branch 'Features/StudentAcceptedCount' into 'develop'

Features/student accepted count

See merge request !18
parents 0372c497 b9039abc
......@@ -36,6 +36,7 @@ export default class ProfilePage extends React.Component {
show_transcript: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
refresh: 1,
};
this.getProfile = this.getProfile.bind(this);
......@@ -63,6 +64,7 @@ export default class ProfilePage extends React.Component {
phone_number: data.phone_number,
photo: data.photo,
show_transcript: data.show_transcript,
acceptedNo: data.accepted_no,
bagikanTranskrip: data.show_transcript,
refresh: this.state.refresh + 1,
});
......@@ -177,6 +179,7 @@ export default class ProfilePage extends React.Component {
<h5> { this.state.email } </h5>
<h5> { this.state.phone_number } </h5>
<h5> { this.state.cityOfBirth}, { this.state.dateOfBirth } </h5>
<p>Sudah diterima di { this.state.acceptedNo } perusahaan</p>
</div>
<div className="button-profile">
<a target="_blank" rel="noopener noreferrer" href={this.state.resume ? this.state.resume : '#'} >
......
......@@ -2,7 +2,7 @@ from django.contrib.auth.models import User
from rest_framework import serializers
from core.models.accounts import Supervisor, Company, Student
from core.models.vacancies import Application
class BasicUserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
......@@ -13,11 +13,17 @@ class BasicUserSerializer(serializers.HyperlinkedModelSerializer):
class StudentSerializer(serializers.ModelSerializer):
user = BasicUserSerializer()
name = serializers.ReadOnlyField()
accepted_no = serializers.SerializerMethodField()
class Meta:
model = Student
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo']
'show_transcript', 'photo', 'accepted_no']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
companies = apps.values('vacancy__company').distinct()
return companies.count()
class StudentUpdateSerializer(serializers.ModelSerializer):
......
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