From a8fa71c7baa5df8722279f8ae533b2371190e3ce Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 5 Oct 2019 19:24:17 +0700
Subject: [PATCH 01/10] add test for fitur website

---
 assets/js/__test__/CompanyProfile-test.jsx | 1 +
 core/tests/test_accounts.py                | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/assets/js/__test__/CompanyProfile-test.jsx b/assets/js/__test__/CompanyProfile-test.jsx
index e1a9d657..0a4e3dd2 100644
--- a/assets/js/__test__/CompanyProfile-test.jsx
+++ b/assets/js/__test__/CompanyProfile-test.jsx
@@ -25,6 +25,7 @@ const companyUser = {
       logo: 'http://localhost:8001/files/company-logo/8a258a48-3bce-4873-b5d1-538b360d0059.png',
       address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
       category: 'Belum ada kategori perusahaan',
+      website: 'Belum ada link website'
     },
     supervisor: null,
     student: null,
diff --git a/core/tests/test_accounts.py b/core/tests/test_accounts.py
index 35812f92..9205edd3 100644
--- a/core/tests/test_accounts.py
+++ b/core/tests/test_accounts.py
@@ -91,7 +91,7 @@ class RegisterTests(APITestCase):
 
     def test_create_and_recreate(self):
         url = '/api/register/'
-        tc_post = {'password': 'corporatepass', 'name':'tutuplapak', 'description':'menutup lapak', 'email': 'email@email.com', 'logo':'lalala', 'address':'alamat', 'category':'Perusahaan Jasa'}
+        tc_post = {'password': 'corporatepass', 'name':'tutuplapak', 'description':'menutup lapak', 'email': 'email@email.com', 'logo':'lalala', 'address':'alamat', 'category':'Perusahaan Jasa', 'website':'www.tutuplapak.com'}
         response = self.client.post(url, tc_post, format='multipart')
         self.assertEqual(response.status_code, status.HTTP_201_CREATED)
 
-- 
GitLab


From f19769c3cb2c5adadab715d282bab8bd44df21bc Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 5 Oct 2019 19:39:14 +0700
Subject: [PATCH 02/10] add implementation for fitur website

---
 assets/js/CompanyProfile.jsx                  | 1 +
 assets/js/components/CompanyRegisterModal.jsx | 4 ++++
 core/models/accounts.py                       | 1 +
 core/views/accounts.py                        | 5 +++--
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/assets/js/CompanyProfile.jsx b/assets/js/CompanyProfile.jsx
index 3c909b0f..e66b186d 100644
--- a/assets/js/CompanyProfile.jsx
+++ b/assets/js/CompanyProfile.jsx
@@ -22,6 +22,7 @@ export default class CompanyProfile extends React.Component {
               <h2>{ data.name }</h2>
               <h3>{ data.address }t</h3>
               <p>{ data.category } - { data.description }</p>
+              <p>{ data.website }</p>
             </div>
           </Container>
         </Segment>
diff --git a/assets/js/components/CompanyRegisterModal.jsx b/assets/js/components/CompanyRegisterModal.jsx
index 78438951..404103ed 100644
--- a/assets/js/components/CompanyRegisterModal.jsx
+++ b/assets/js/components/CompanyRegisterModal.jsx
@@ -155,6 +155,10 @@ export default class CompanyRegisterModal extends React.Component {
             <label htmlFor="address">Alamat</label>
             <Input onChange={this.handleChange} placeholder="Alamat" name="address" required />
           </Form.Field>
+          <Form.Field required>
+            <label htmlFor="address">Website</label>
+            <Input onChange={this.handleChange} placeholder="Website perusahaan anda" name="website" required />
+          </Form.Field>
           <Modal.Actions style={{ textAlign: 'right' }}>
             <Button loading={this.state.loading} type="submit" color="blue"> <Icon name="checkmark" />Submit</Button>
           </Modal.Actions>
diff --git a/core/models/accounts.py b/core/models/accounts.py
index ed406bfb..b565213d 100644
--- a/core/models/accounts.py
+++ b/core/models/accounts.py
@@ -97,6 +97,7 @@ class Company(models.Model):
     logo = models.FileField(upload_to=get_company_logo_file_path, null=True, blank=True,  validators=[validate_image_file_extension])
     address = models.CharField(max_length=1000, blank=True, null=True)
     category = models.CharField(max_length=140, default="Belum ada kategori perusahaan")
+    website = models.CharField(max_length=100, default="Belum ada link website")
 
     @property
     def name(self):
diff --git a/core/views/accounts.py b/core/views/accounts.py
index d95c1200..8cadcadf 100644
--- a/core/views/accounts.py
+++ b/core/views/accounts.py
@@ -240,7 +240,7 @@ class CompanyRegisterViewSet(viewsets.GenericViewSet):
               type: string
         """
         data = {}
-        for attr in ['password', 'email', 'name', 'description', 'logo', 'address', 'category']:
+        for attr in ['password', 'email', 'name', 'description', 'logo', 'address', 'category', 'website']:
             data[attr] = request.data.get(attr)
             if data[attr] is None:
                 return Response({'error': attr+' is required'}, status=status.HTTP_400_BAD_REQUEST)
@@ -258,7 +258,8 @@ class CompanyRegisterViewSet(viewsets.GenericViewSet):
                 description=data['description'],
                 logo=data['logo'],
                 address=data['address'],
-                category=data['category']
+                category=data['category'],
+                website=data['website']
             )
             user.save()
             company.save()
-- 
GitLab


From bcbaffe130499ffe52d25f1da2742393adfaf7ec Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 5 Oct 2019 19:59:42 +0700
Subject: [PATCH 03/10] add makemigrations

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 040e750d..53ce6292 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,6 +24,7 @@ test:
     - npm install
     - npm run build-production
     - pip install -r requirements.txt
+    - python manage.py makemigrations
     - python manage.py migrate
     - python manage.py test
     - npm run karma
-- 
GitLab


From 8fcb6c97bd0efb7850d9ea97a25bf383a05e28e5 Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 5 Oct 2019 22:06:30 +0700
Subject: [PATCH 04/10] fix makemigrations merge

---
 core/migrations/0014_company_category.py | 20 --------------------
 1 file changed, 20 deletions(-)
 delete mode 100644 core/migrations/0014_company_category.py

diff --git a/core/migrations/0014_company_category.py b/core/migrations/0014_company_category.py
deleted file mode 100644
index 7d2db3cb..00000000
--- a/core/migrations/0014_company_category.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.5 on 2019-10-05 04:52
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
-    dependencies = [
-        ('core', '0013_auto_20170602_1130'),
-    ]
-
-    operations = [
-        migrations.AddField(
-            model_name='company',
-            name='category',
-            field=models.CharField(default=b'Belum ada kategori perusahaan', max_length=140),
-        ),
-    ]
-- 
GitLab


From 9cbd8ddc727f27f22f08f9a5b8dcce04f2eb3be0 Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sun, 6 Oct 2019 10:44:17 +0700
Subject: [PATCH 05/10] recommit after pull from master

---
 core/migrations/0014_company_category.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 core/migrations/0014_company_category.py

diff --git a/core/migrations/0014_company_category.py b/core/migrations/0014_company_category.py
new file mode 100644
index 00000000..7d2db3cb
--- /dev/null
+++ b/core/migrations/0014_company_category.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2019-10-05 04:52
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('core', '0013_auto_20170602_1130'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='company',
+            name='category',
+            field=models.CharField(default=b'Belum ada kategori perusahaan', max_length=140),
+        ),
+    ]
-- 
GitLab


From 02d3c2581e25029a5577a2ad31c30d126bc7b81b Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 9 Nov 2019 02:18:41 +0700
Subject: [PATCH 06/10] add implementation

---
 core/models/feedbacks.py | 1 +
 core/views/feedbacks.py  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/models/feedbacks.py b/core/models/feedbacks.py
index c473ae82..df2b16b5 100755
--- a/core/models/feedbacks.py
+++ b/core/models/feedbacks.py
@@ -5,6 +5,7 @@ class Feedback(models.Model):
     created = models.DateTimeField(auto_now_add=True)
     title = models.CharField(max_length=100, blank=True, default='')
     content = models.TextField()
+    score = models.CharField(max_length=10, blank=True, default='')
 
     class Meta:
         ordering = ['created']
diff --git a/core/views/feedbacks.py b/core/views/feedbacks.py
index fa357206..d58a4277 100755
--- a/core/views/feedbacks.py
+++ b/core/views/feedbacks.py
@@ -34,7 +34,7 @@ class FeedbackViewSet(viewsets.GenericViewSet):
         ---
         """
         if 'title' in request.data and 'content' in request.data:
-            new_feedback = Feedback(title=request.data['title'], content=request.data['content'])
+            new_feedback = Feedback(title=request.data['title'], content=request.data['content'], score=request.data['score'])
             new_feedback.save()
             serialized_new_feedback = FeedbackSerializer(new_feedback, context={'request': request})
             serialized_new_feedback_data = serialized_new_feedback.data
@@ -70,7 +70,7 @@ class FeedbackViewSet(viewsets.GenericViewSet):
         if Feedback.objects.filter(id=pk).count() != 0:
             print (request.data)
             update_feedback = Feedback.objects.filter(id=pk)
-            update_feedback.update(title=request.data['title'], content=request.data['content'])
+            update_feedback.update(title=request.data['title'], content=request.data['content'], score=request.data['score'])
 
             update_feedback = Feedback.objects.get(id=pk)
             serialized_update_feedback = FeedbackSerializer(update_feedback, context={'request': request})
-- 
GitLab


From caf4a471427a90b21b029741c8e1343a3c8fb66c Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 9 Nov 2019 02:34:25 +0700
Subject: [PATCH 07/10] edit test

---
 core/tests/test_feedbacks.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/core/tests/test_feedbacks.py b/core/tests/test_feedbacks.py
index 99e411c2..e5db9158 100755
--- a/core/tests/test_feedbacks.py
+++ b/core/tests/test_feedbacks.py
@@ -157,13 +157,11 @@ class FeedbacksTests(APITestCase):
         # test_feedbacks_create_with_title_and_content
         feedbacks_url = '/api/feedbacks/'
         response = self.client.post(feedbacks_url,
-                                    {"content": "a content", "title": "a title", 
-                                     "score": "0"})
+                                    {"content": "a content", "title": "a title"})
 
         self.assertEqual(response.status_code, status.HTTP_200_OK)
         self.assertEqual(response.data["title"], "a title")
         self.assertEqual(response.data["content"], "a content")
-        self.assertEqual(response.data["score"], "0")
 
     @requests_mock.Mocker()
     def test_feedbacks_create_without_title_and_with_content(self, m):
@@ -265,7 +263,7 @@ class FeedbacksTests(APITestCase):
 
         # test_feedbacks_update_with_exist_data_and_with_data_id
 
-        new_feedback = Feedback(title="a title", content="a content")
+        new_feedback = Feedback(title="a title", content="a content", score="0")
         new_feedback.save()
         feedback_id = new_feedback.id
 
-- 
GitLab


From 48f2ec1399829f737e201bcf5b3f7b278ac8645b Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 9 Nov 2019 22:39:08 +0700
Subject: [PATCH 08/10] change implementation

---
 assets/js/CompanyProfile.jsx |  7 ------
 assets/js/FeedbackPage.jsx   |  5 ----
 core/models/feedbacks.py     |  1 -
 core/tests/test_feedbacks.py |  2 +-
 core/tests/test_vacancies.py | 48 ++++++++++++++++++++++++++++++++++++
 core/views/vacancies.py      | 10 ++++++++
 6 files changed, 59 insertions(+), 14 deletions(-)

diff --git a/assets/js/CompanyProfile.jsx b/assets/js/CompanyProfile.jsx
index 4499463e..d33d1f67 100644
--- a/assets/js/CompanyProfile.jsx
+++ b/assets/js/CompanyProfile.jsx
@@ -119,17 +119,10 @@ export default class CompanyProfile extends React.Component {
           </Header>
           <Container textAlign="center" className="profile-biodata">
             <div className="biodataCompany">
-<<<<<<< HEAD
-              <h2>{ data.name }</h2>
-              <h3>{ data.address }t</h3>
-              <p>{ data.category } - { data.description }</p>
-              <p>{ data.website }</p>
-=======
               <h2>{ this.state.name }</h2>
               <h3>{ this.state.address }</h3>
               <p>{ this.state.category } - { this.state.description }</p>
               <p>{ this.state.website }</p>
->>>>>>> 159b1da19bf90f8a7ee4093385c8efb478873e3e
             </div>
           </Container>
           <Container textAlign="center" className="statistik">
diff --git a/assets/js/FeedbackPage.jsx b/assets/js/FeedbackPage.jsx
index ee72219d..b18cd44d 100644
--- a/assets/js/FeedbackPage.jsx
+++ b/assets/js/FeedbackPage.jsx
@@ -48,11 +48,6 @@ class FeedbackPage extends Component {
               <label>Umpan Balik</label>
               <TextArea name="content" onChange={this.handleChange} placeholder="Umpan Balik" />
             </Form.Field>
-            <Form.Field required>
-              {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
-              <label>Nilai (1-10)</label>
-              <TextArea name="score" onChange={this.handleChange} placeholder="Nilai" />
-            </Form.Field>
             <Button type="submit">Simpan</Button>
           </Form>
         </Container>
diff --git a/core/models/feedbacks.py b/core/models/feedbacks.py
index df2b16b5..c473ae82 100755
--- a/core/models/feedbacks.py
+++ b/core/models/feedbacks.py
@@ -5,7 +5,6 @@ class Feedback(models.Model):
     created = models.DateTimeField(auto_now_add=True)
     title = models.CharField(max_length=100, blank=True, default='')
     content = models.TextField()
-    score = models.CharField(max_length=10, blank=True, default='')
 
     class Meta:
         ordering = ['created']
diff --git a/core/tests/test_feedbacks.py b/core/tests/test_feedbacks.py
index e5db9158..240bdb55 100755
--- a/core/tests/test_feedbacks.py
+++ b/core/tests/test_feedbacks.py
@@ -263,7 +263,7 @@ class FeedbacksTests(APITestCase):
 
         # test_feedbacks_update_with_exist_data_and_with_data_id
 
-        new_feedback = Feedback(title="a title", content="a content", score="0")
+        new_feedback = Feedback(title="a title", content="a content")
         new_feedback.save()
         feedback_id = new_feedback.id
 
diff --git a/core/tests/test_vacancies.py b/core/tests/test_vacancies.py
index 07a0f67e..e558113d 100755
--- a/core/tests/test_vacancies.py
+++ b/core/tests/test_vacancies.py
@@ -838,6 +838,54 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
         response_status_code = response.status_code
         self.assertEqual(response_status_code, 400)
 
+    def test_salary_contains_number_only(self):
+        self.payload["salary"] = 2312312
+
+        response = self.client.post(
+            self.url,
+            self.payload,
+            format="json"
+        )
+
+        response_status_code = response.status_code
+        self.assertEqual(response_status_code, 200)
+
+    def test_salary_contains_number_and_alphabet(self):
+        self.payload["salary"] = "sdsaa"
+
+        response = self.client.post(
+            self.url,
+            self.payload,
+            format="json"
+        )
+
+        response_status_code = response.status_code
+        self.assertEqual(response_status_code, 400)
+
+    def test_amount_contains_number_only(self):
+        self.payload["amount"] = 231231221312
+
+        response = self.client.post(
+            self.url,
+            self.payload,
+            format="json"
+        )
+
+        response_status_code = response.status_code
+        self.assertEqual(response_status_code, 200)
+
+    def test_amount_contains_number_and_alphabet(self):
+        self.payload["salary"] = "sadas231"
+
+        response = self.client.post(
+            self.url,
+            self.payload,
+            format="json"
+        )
+
+        response_status_code = response.status_code
+        self.assertEqual(response_status_code, 400)
+
 
 class VacancyMilestoneTests(APITestCase):
     def setUp(self):
diff --git a/core/views/vacancies.py b/core/views/vacancies.py
index 6ca63e39..cec2971e 100644
--- a/core/views/vacancies.py
+++ b/core/views/vacancies.py
@@ -75,6 +75,14 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
                 raise serializers.ValidationError("Name must alphabets only")
         return name
 
+    def salary_validator(self, salary)
+        if not isinstance(salary, int):
+            raise serializers.ValidationError("Salary must number only")
+
+    def amount_validator(self, amount):
+        if not isinstance(amount, int):
+            raise serializers.ValidationError("amount must number only")
+
     def create(self, request):
         data = request.data
         print("[LOG] data: "+str(data))
@@ -87,6 +95,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
         name = data['name']
         self.name_position_validator(name)
         salary = data.get('salary') or 0
+        self.salary_validator(salary)
         description = data['description']
         working_period = data['working_period']
         requirements = data['requirements']
@@ -111,6 +120,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
         if 'amount' in data:
             if isinstance(data['amount'], int):
                 vacancy.amount = data['amount']
+                self.amount_validator(data['amount'])
             else:
                 return Response(status=status.HTTP_400_BAD_REQUEST)
         if 'responsibilities' in data:
-- 
GitLab


From bb420f334a5c6e58f00f026515ff47659679c575 Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 9 Nov 2019 22:41:52 +0700
Subject: [PATCH 09/10] fix minor error in views

---
 core/views/vacancies.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/views/vacancies.py b/core/views/vacancies.py
index cec2971e..0b0bb183 100644
--- a/core/views/vacancies.py
+++ b/core/views/vacancies.py
@@ -75,7 +75,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
                 raise serializers.ValidationError("Name must alphabets only")
         return name
 
-    def salary_validator(self, salary)
+    def salary_validator(self, salary):
         if not isinstance(salary, int):
             raise serializers.ValidationError("Salary must number only")
 
-- 
GitLab


From 92273c58fd78aea7c3349c21005ade12498b6113 Mon Sep 17 00:00:00 2001
From: Ryan Naufal <ryan.naufal@ui.ac.id>
Date: Sat, 9 Nov 2019 22:46:50 +0700
Subject: [PATCH 10/10] fix minor error in views about previous implementation

---
 core/views/feedbacks.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/views/feedbacks.py b/core/views/feedbacks.py
index d58a4277..fa357206 100755
--- a/core/views/feedbacks.py
+++ b/core/views/feedbacks.py
@@ -34,7 +34,7 @@ class FeedbackViewSet(viewsets.GenericViewSet):
         ---
         """
         if 'title' in request.data and 'content' in request.data:
-            new_feedback = Feedback(title=request.data['title'], content=request.data['content'], score=request.data['score'])
+            new_feedback = Feedback(title=request.data['title'], content=request.data['content'])
             new_feedback.save()
             serialized_new_feedback = FeedbackSerializer(new_feedback, context={'request': request})
             serialized_new_feedback_data = serialized_new_feedback.data
@@ -70,7 +70,7 @@ class FeedbackViewSet(viewsets.GenericViewSet):
         if Feedback.objects.filter(id=pk).count() != 0:
             print (request.data)
             update_feedback = Feedback.objects.filter(id=pk)
-            update_feedback.update(title=request.data['title'], content=request.data['content'], score=request.data['score'])
+            update_feedback.update(title=request.data['title'], content=request.data['content'])
 
             update_feedback = Feedback.objects.get(id=pk)
             serialized_update_feedback = FeedbackSerializer(update_feedback, context={'request': request})
-- 
GitLab