From bb32f5a92a0f20dbd0f673c3b3beab69f47dd892 Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Mon, 5 Apr 2021 19:32:10 +0530 Subject: [PATCH] fix: Rename utilisation to utilization --- .../__init__.py | 0 ...e_hours_utilization_based_on_timesheet.js} | 2 +- ...hours_utilization_based_on_timesheet.json} | 8 +++---- ...e_hours_utilization_based_on_timesheet.py} | 22 +++++++++---------- .../test_employee_util.py | 10 ++++----- 5 files changed, 21 insertions(+), 21 deletions(-) rename erpnext/projects/report/{employee_hours_utilisation_based_on_timesheet => employee_hours_utilization_based_on_timesheet}/__init__.py (100%) rename erpnext/projects/report/{employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.js => employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js} (93%) rename erpnext/projects/report/{employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.json => employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.json} (63%) rename erpnext/projects/report/{employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py => employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py} (92%) rename erpnext/projects/report/{employee_hours_utilisation_based_on_timesheet => employee_hours_utilization_based_on_timesheet}/test_employee_util.py (92%) diff --git a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/__init__.py b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/__init__.py similarity index 100% rename from erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/__init__.py rename to erpnext/projects/report/employee_hours_utilization_based_on_timesheet/__init__.py diff --git a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.js b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js similarity index 93% rename from erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.js rename to erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js index e9b817ab67..2a5ea3655d 100644 --- a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.js +++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js @@ -2,7 +2,7 @@ // For license information, please see license.txt /* eslint-disable */ -frappe.query_reports["Employee Hours Utilisation Based On Timesheet"] = { +frappe.query_reports["Employee Hours Utilization Based On Timesheet"] = { "filters": [ { fieldname: "company", diff --git a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.json b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.json similarity index 63% rename from erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.json rename to erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.json index 1b504e011d..5ff8186572 100644 --- a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.json +++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.json @@ -1,7 +1,7 @@ { "add_total_row": 0, "columns": [], - "creation": "2021-03-30 12:18:02.090630", + "creation": "2021-04-05 19:23:43.838623", "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, @@ -9,14 +9,14 @@ "filters": [], "idx": 0, "is_standard": "Yes", - "modified": "2021-03-30 12:18:02.090630", + "modified": "2021-04-05 19:23:43.838623", "modified_by": "Administrator", "module": "Projects", - "name": "Employee Hours Utilisation Based On Timesheet", + "name": "Employee Hours Utilization Based On Timesheet", "owner": "Administrator", "prepared_report": 0, "ref_doctype": "Timesheet", - "report_name": "Employee Hours Utilisation Based On Timesheet", + "report_name": "Employee Hours Utilization Based On Timesheet", "report_type": "Script Report", "roles": [] } \ No newline at end of file diff --git a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py similarity index 92% rename from erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py rename to erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py index 19cb1c911d..bc9dc7d095 100644 --- a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py +++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py @@ -11,7 +11,7 @@ def execute(filters=None): return EmployeeHoursReport(filters).run() class EmployeeHoursReport: - '''Employee Hours Utilisation Report Based On Timesheet''' + '''Employee Hours Utilization Report Based On Timesheet''' def __init__(self, filters=None): self.filters = frappe._dict(filters or {}) @@ -78,7 +78,7 @@ class EmployeeHoursReport: def generate_data(self): self.generate_filtered_time_logs() self.generate_stats_by_employee() - self.calculate_utilisations() + self.calculate_utilizations() self.data = [] @@ -88,7 +88,7 @@ class EmployeeHoursReport: row.update(data) self.data.append(row) - # Sort by descending order of percentage utilisation + # Sort by descending order of percentage utilization self.data.sort(key=lambda x: x['per_util'], reverse=True) def generate_filtered_time_logs(self): @@ -128,7 +128,7 @@ class EmployeeHoursReport: else: self.stats_by_employee[emp]['non_billed_hours'] += flt(hours, 2) - def calculate_utilisations(self): + def calculate_utilizations(self): # (9.0) Will be fetched from HR settings TOTAL_HOURS = flt(9.0 * self.day_span, 2) for emp, data in iteritems(self.stats_by_employee): @@ -147,25 +147,25 @@ class EmployeeHoursReport: if not self.data: return - avg_utilisation = 0.0 + avg_utilization = 0.0 total_billed, total_non_billed = 0.0, 0.0 total_untracked = 0.0 for row in self.data: - avg_utilisation += row['per_util'] + avg_utilization += row['per_util'] total_billed += row['billed_hours'] total_non_billed += row['non_billed_hours'] total_untracked += row['untracked_hours'] - avg_utilisation /= len(self.data) - avg_utilisation = flt(avg_utilisation, 2) + avg_utilization /= len(self.data) + avg_utilization = flt(avg_utilization, 2) THRESHOLD_PERCENTAGE = 70.0 self.report_summary = [ { - 'value': f'{avg_utilisation}%', - 'indicator': 'Red' if avg_utilisation < THRESHOLD_PERCENTAGE else 'Green', - 'label': _('Average Utilisation'), + 'value': f'{avg_utilization}%', + 'indicator': 'Red' if avg_utilization < THRESHOLD_PERCENTAGE else 'Green', + 'label': _('Average Utilization'), 'datatype': 'Percentage' }, { diff --git a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/test_employee_util.py b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py similarity index 92% rename from erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/test_employee_util.py rename to erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py index adf55afc14..5306b922eb 100644 --- a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/test_employee_util.py +++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py @@ -4,11 +4,11 @@ import frappe from frappe.utils.make_random import get_random from frappe.utils import get_timestamp -from erpnext.projects.report.employee_hours_utilisation_based_on_timesheet.employee_hours_utilisation_based_on_timesheet import execute +from erpnext.projects.report.employee_hours_utilization_based_on_timesheet.employee_hours_utilization_based_on_timesheet import execute from erpnext.hr.doctype.employee.test_employee import make_employee from erpnext.projects.doctype.project.test_project import make_project -class TestEmployeeUtilisation(unittest.TestCase): +class TestEmployeeUtilization(unittest.TestCase): @classmethod def setUpClass(cls): # Create test employee @@ -69,7 +69,7 @@ class TestEmployeeUtilisation(unittest.TestCase): frappe.db.sql("DELETE FROM `tabTimesheet` WHERE company='_Test Company'") frappe.db.sql(f"DELETE FROM `tabProject` WHERE name='{cls.test_project.name}'") - def test_utilisation_report_with_required_filters_only(self): + def test_utilization_report_with_required_filters_only(self): filters = { "company": "_Test Company", "from_date": "2021-04-01", @@ -99,7 +99,7 @@ class TestEmployeeUtilisation(unittest.TestCase): self.assertEqual(report[1], expected_data) - def test_utilisation_report_for_single_employee(self): + def test_utilization_report_for_single_employee(self): filters = { "company": "_Test Company", "from_date": "2021-04-01", @@ -122,7 +122,7 @@ class TestEmployeeUtilisation(unittest.TestCase): self.assertEqual(report[1], expected_data) - def test_utilisation_report_for_project(self): + def test_utilization_report_for_project(self): filters = { "company": "_Test Company", "from_date": "2021-04-01",