From 3e73283f5a7a2d78e46404cf7e6c1eab6afa7a18 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <luthfi.dzaky@ui.ac.id> Date: Thu, 3 Oct 2019 20:07:51 +0700 Subject: [PATCH 01/10] add test for profile page --- assets/js/__test__/ProfilePage-test.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/assets/js/__test__/ProfilePage-test.jsx b/assets/js/__test__/ProfilePage-test.jsx index a98b3452..ec4b1d99 100644 --- a/assets/js/__test__/ProfilePage-test.jsx +++ b/assets/js/__test__/ProfilePage-test.jsx @@ -212,5 +212,12 @@ describe('ProfilePage', () => { expect(profile.state.form.photo).to.equal('abc'); }); - + it('renders application without problem', () => { + fetchMock.get('*', response); + const profile = ReactTestUtils.renderIntoDocument( + <ProfilePage route={{ own: true, data: studentSession }} user={{ data: studentSession }} params={{}} />); + profile.getProfile().then(()=> expect(profile.state.acceptedNo).to.not.equal('-1')); + profile.getProfile().then(()=> expect(profile.state.readNo).to.not.equal('-1')); + fetchMock.restore(); + }); }); -- GitLab From 420a04f3f01e8b547e6506f4bf714875b5a3def4 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <luthfi.dzaky@ui.ac.id> Date: Thu, 3 Oct 2019 20:09:55 +0700 Subject: [PATCH 02/10] add serializer and method for counting read application --- core/serializers/accounts.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/serializers/accounts.py b/core/serializers/accounts.py index e57747ce..0007e52a 100644 --- a/core/serializers/accounts.py +++ b/core/serializers/accounts.py @@ -15,17 +15,23 @@ class StudentSerializer(serializers.ModelSerializer): user = BasicUserSerializer() name = serializers.ReadOnlyField() accepted_no = serializers.SerializerMethodField() + read_no = serializers.SerializerMethodField() class Meta: model = Student fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'birth_place', 'birth_date', 'major', 'batch', \ - 'show_transcript', 'photo', 'accepted_no'] + 'show_transcript', 'photo', 'accepted_no', 'read_no'] def get_accepted_no(self, obj): apps = Application.objects.filter(student=obj, status=4) companies = apps.values('vacancy__company').distinct() return companies.count() + def get_read_no(self, obj): + apps = Application.objects.filter(student=obj, status=1) + companies = apps.values('vacancy__company').distinct() + return companies.count() + class StudentUpdateSerializer(serializers.ModelSerializer): email = serializers.EmailField() -- GitLab From 625f31a72acd6b05a2f144f7b1b2b5e4de81c165 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <luthfi.dzaky@ui.ac.id> Date: Thu, 3 Oct 2019 20:26:35 +0700 Subject: [PATCH 03/10] add profile page for jumlah lamaran --- assets/css/custom.css | 4 ++++ assets/js/ProfilePage.jsx | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/assets/css/custom.css b/assets/css/custom.css index 9b7cf50a..0e008c26 100755 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -289,4 +289,8 @@ card .formRegis{ .ui.segment.kop { line-height: 5px; +} + +.jumlahLamaran { + font-weight: bold; } \ No newline at end of file diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index a9c0fc9f..697c6a68 100644 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -38,6 +38,7 @@ export default class ProfilePage extends React.Component { }, bagikanTranskrip: '', acceptedNo: 0, + readNo: 0, refresh: 1, loading: false, }; @@ -69,6 +70,7 @@ export default class ProfilePage extends React.Component { photo: data.photo, show_transcript: data.show_transcript, acceptedNo: data.accepted_no, + readNo: data.read_no, bagikanTranskrip: data.show_transcript, refresh: this.state.refresh + 1, }); @@ -239,6 +241,16 @@ export default class ProfilePage extends React.Component { </Grid.Column> </Grid> </Segment> + + <Segment basic vertical> + <Grid> + <p className="jumlahLamaran"> Jumlah lamaran diterima: {this.state.acceptedNo || '0' }</p> + </Grid> + <Grid> + <p className="jumlahLamaran"> Jumlah lamaran dibaca perusahaan: {this.state.readNo || '0' }</p> + </Grid> + </Segment> + </div> <Container textAlign="center"> -- GitLab From 4e0b652b8233185aedc15ab556b787c57046aa52 Mon Sep 17 00:00:00 2001 From: LUTHFI DZAKY SAIFUDDIN <luthfi.dzaky@ui.ac.id> Date: Fri, 4 Oct 2019 06:44:37 +0700 Subject: [PATCH 04/10] update test in profile page --- assets/js/__test__/ProfilePage-test.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/__test__/ProfilePage-test.jsx b/assets/js/__test__/ProfilePage-test.jsx index ec4b1d99..832d2283 100644 --- a/assets/js/__test__/ProfilePage-test.jsx +++ b/assets/js/__test__/ProfilePage-test.jsx @@ -212,12 +212,12 @@ describe('ProfilePage', () => { expect(profile.state.form.photo).to.equal('abc'); }); - it('renders application without problem', () => { + it('renders count application without problem', () => { fetchMock.get('*', response); const profile = ReactTestUtils.renderIntoDocument( <ProfilePage route={{ own: true, data: studentSession }} user={{ data: studentSession }} params={{}} />); - profile.getProfile().then(()=> expect(profile.state.acceptedNo).to.not.equal('-1')); - profile.getProfile().then(()=> expect(profile.state.readNo).to.not.equal('-1')); + profile.getProfile().then(()=> expect(profile.state.acceptedNo).to.not.equal('null')); + profile.getProfile().then(()=> expect(profile.state.readNo).to.not.equal('null')); fetchMock.restore(); }); }); -- GitLab From 941e8425778b4a5a6cc70bd7b83c682730d29bcf Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <luthfi.dzaky@ui.ac.id> Date: Fri, 4 Oct 2019 20:00:06 +0700 Subject: [PATCH 05/10] pull master and edit test again --- assets/js/__test__/ProfilePage-test.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/__test__/ProfilePage-test.jsx b/assets/js/__test__/ProfilePage-test.jsx index 832d2283..41e711d3 100644 --- a/assets/js/__test__/ProfilePage-test.jsx +++ b/assets/js/__test__/ProfilePage-test.jsx @@ -216,8 +216,8 @@ describe('ProfilePage', () => { fetchMock.get('*', response); const profile = ReactTestUtils.renderIntoDocument( <ProfilePage route={{ own: true, data: studentSession }} user={{ data: studentSession }} params={{}} />); - profile.getProfile().then(()=> expect(profile.state.acceptedNo).to.not.equal('null')); - profile.getProfile().then(()=> expect(profile.state.readNo).to.not.equal('null')); + profile.getProfile().then(()=> expect(profile.state.acceptedNo).to.not.equal('')); + profile.getProfile().then(()=> expect(profile.state.readNo).to.not.equal('')); fetchMock.restore(); }); }); -- GitLab From 7267b5243a0155b33ae57aaad634526d924b153e Mon Sep 17 00:00:00 2001 From: luthfidzaky <luthfidzaky@komputer.local> Date: Sun, 6 Oct 2019 15:59:06 +0700 Subject: [PATCH 06/10] resolve migrate conflict --- core/migrations/0020_merge_20191006_1558.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 core/migrations/0020_merge_20191006_1558.py diff --git a/core/migrations/0020_merge_20191006_1558.py b/core/migrations/0020_merge_20191006_1558.py new file mode 100644 index 00000000..abf6f223 --- /dev/null +++ b/core/migrations/0020_merge_20191006_1558.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.17 on 2019-10-06 08:58 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0017_vacancy_amount'), + ('core', '0019_merge_20191006_0852'), + ] + + operations = [ + ] -- GitLab From a82853a57babb09503cd4387640e9eb9c6f3fbfd Mon Sep 17 00:00:00 2001 From: luthfidzaky <luthfidzaky@komputer.local> Date: Sun, 6 Oct 2019 16:40:48 +0700 Subject: [PATCH 07/10] merge migrations --- core/migrations/0021_merge_20191006_1640.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 core/migrations/0021_merge_20191006_1640.py diff --git a/core/migrations/0021_merge_20191006_1640.py b/core/migrations/0021_merge_20191006_1640.py new file mode 100644 index 00000000..2ed2f5ee --- /dev/null +++ b/core/migrations/0021_merge_20191006_1640.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.17 on 2019-10-06 09:40 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0020_merge_20191006_1558'), + ('core', '0014_auto_20191004_1340'), + ] + + operations = [ + ] -- GitLab From b2bfe9d317a2af76bd8d1a43c4b167ed1f146e49 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <dzakyluthfi28@gmail.com> Date: Tue, 8 Oct 2019 06:47:23 +0700 Subject: [PATCH 08/10] pull master and migrations merge --- core/migrations/0027_merge_20191008_0646.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 core/migrations/0027_merge_20191008_0646.py diff --git a/core/migrations/0027_merge_20191008_0646.py b/core/migrations/0027_merge_20191008_0646.py new file mode 100644 index 00000000..7c930150 --- /dev/null +++ b/core/migrations/0027_merge_20191008_0646.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.17 on 2019-10-07 23:46 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0026_merge_20191008_0256'), + ('core', '0021_merge_20191006_1640'), + ] + + operations = [ + ] -- GitLab From 89c41747482dedc982b6eea4cd00db56aaa5253a Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <dzakyluthfi28@gmail.com> Date: Tue, 8 Oct 2019 07:37:01 +0700 Subject: [PATCH 09/10] resolve conflict --- assets/js/ProfilePage.jsx | 57 ++++++++++++++------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index 2bf4384f..766720f3 100644 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -275,8 +275,8 @@ export default class ProfilePage extends React.Component { </Grid.Column> </Grid> </Segment> - - <Segment basic vertical> + + <Segment basic vertical> <Grid> <Grid.Column width={2}> <Icon name="linkedin" size="big" /> @@ -309,42 +309,25 @@ export default class ProfilePage extends React.Component { </Segment> </div> + <Segment basic vertical> + <Grid> + <Grid.Column width={2}> + <h3>Intro</h3> + </Grid.Column> + <Grid.Column width={13}> + <p> { this.state.intro || 'N/A' } </p> + </Grid.Column> + </Grid> + </Segment> - <Segment basic vertical> - <Grid> - <Grid.Column width={2}> - <h3>Intro</h3> - </Grid.Column> - <Grid.Column width={13}> - <p> { this.state.intro || 'N/A' } </p> - </Grid.Column> - </Grid> - </Segment> - - - - - <Segment basic vertical> - <Grid> - <Grid.Column width={2}> - <h3>Intro</h3> - </Grid.Column> - <Grid.Column width={13}> - <p> { this.state.intro || 'N/A' } </p> - </Grid.Column> - </Grid> - </Segment> - - <Segment basic vertical> - <Grid> - <p className="jumlahLamaran"> Jumlah lamaran diterima: {this.state.acceptedNo || '0' }</p> - </Grid> - <Grid> - <p className="jumlahLamaran"> Jumlah lamaran dibaca perusahaan: {this.state.readNo || '0' }</p> - </Grid> - </Segment> - </div> - + <Segment basic vertical> + <Grid> + <p className="jumlahLamaran"> Jumlah lamaran diterima: {this.state.acceptedNo || '0' }</p> + </Grid> + <Grid> + <p className="jumlahLamaran"> Jumlah lamaran dibaca perusahaan: {this.state.readNo || '0' }</p> + </Grid> + </Segment> <Container textAlign="center"> <div className="buttonProfile"> <Button onClick={this.gotoStudentResume} disabled={!this.state.resume} primary size="small">Resume</Button> -- GitLab From fe7c1f6115e394c1283a76db43987a2bbeec73e8 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <dzakyluthfi28@gmail.com> Date: Tue, 8 Oct 2019 08:43:41 +0700 Subject: [PATCH 10/10] resolve conflict migrate --- core/migrations/0028_merge_20191008_0843.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 core/migrations/0028_merge_20191008_0843.py diff --git a/core/migrations/0028_merge_20191008_0843.py b/core/migrations/0028_merge_20191008_0843.py new file mode 100644 index 00000000..ddf44864 --- /dev/null +++ b/core/migrations/0028_merge_20191008_0843.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.17 on 2019-10-08 01:43 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0027_merge_20191008_0652'), + ('core', '0027_merge_20191008_0646'), + ] + + operations = [ + ] -- GitLab