From eb22eace69311976f573224e7a485c7eda1a4383 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Sat, 25 Aug 2018 11:28:23 +0530 Subject: [PATCH] Fix: Incentives was not saving Fix: Employee edit was not working --- brewman/views/employee.py | 13 ++++++++----- overlord/src/app/incentive/incentive.component.ts | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/brewman/views/employee.py b/brewman/views/employee.py index 848eda61..ff0ffb94 100644 --- a/brewman/views/employee.py +++ b/brewman/views/employee.py @@ -187,11 +187,14 @@ def employee_info(id, dbsession): employee = dbsession.query(Employee).filter(Employee.id == id).first() if employee is None: raise ValidationError("Invalid Employee") - employee = {'id': employee.id, 'code': employee.code, 'name': employee.name, 'isActive': employee.is_active, - 'designation': employee.designation, 'salary': employee.salary, 'points': employee.service_points, - 'joiningDate': employee.joining_date.strftime('%d-%b-%Y'), - 'leavingDate': None if employee.is_active else employee.leaving_date.strftime('%d-%b-%Y'), - 'costCentre': {'id': employee.cost_centre_id, 'name': employee.cost_centre.name}} + employee = { + 'id': employee.id, 'code': employee.code, 'name': employee.name, + 'isActive': employee.is_active, 'isStarred': employee.is_starred, + 'designation': employee.designation, 'salary': employee.salary, 'points': employee.service_points, + 'joiningDate': employee.joining_date.strftime('%d-%b-%Y'), + 'leavingDate': None if employee.is_active else employee.leaving_date.strftime('%d-%b-%Y'), + 'costCentre': {'id': employee.cost_centre_id, 'name': employee.cost_centre.name} + } return employee diff --git a/overlord/src/app/incentive/incentive.component.ts b/overlord/src/app/incentive/incentive.component.ts index 4713eff0..ff3158f4 100644 --- a/overlord/src/app/incentive/incentive.component.ts +++ b/overlord/src/app/incentive/incentive.component.ts @@ -156,7 +156,7 @@ export class IncentiveComponent implements OnInit { getVoucher(): Voucher { const formModel = this.form.value; this.voucher.date = moment(formModel.date).format('DD-MMM-YYYY'); - const array = this.form.get('attendances') as FormArray; + const array = this.form.get('incentives') as FormArray; this.voucher.incentives.forEach((item, index) => { item.points = array.controls[index].value.points; });