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