perf(minor): remove unnecessary comprehensions (port #25645)

This commit is contained in:
Ankush Menat
2021-06-11 18:40:22 +05:30
committed by GitHub
parent a424c0c023
commit 9891780f5a
64 changed files with 126 additions and 126 deletions

View File

@@ -232,7 +232,7 @@ def get_project(doctype, txt, searchfield, start, page_len, filters):
meta = frappe.get_meta(doctype)
searchfields = meta.get_search_fields()
search_columns = ", " + ", ".join(searchfields) if searchfields else ''
search_cond = " or " + " or ".join([field + " like %(txt)s" for field in searchfields])
search_cond = " or " + " or ".join(field + " like %(txt)s" for field in searchfields)
return frappe.db.sql(""" select name {search_columns} from `tabProject`
where %(key)s like %(txt)s

View File

@@ -87,8 +87,8 @@ class Timesheet(Document):
def set_dates(self):
if self.docstatus < 2 and self.time_logs:
start_date = min([getdate(d.from_time) for d in self.time_logs])
end_date = max([getdate(d.to_time) for d in self.time_logs])
start_date = min(getdate(d.from_time) for d in self.time_logs)
end_date = max(getdate(d.to_time) for d in self.time_logs)
if start_date and end_date:
self.start_date = getdate(start_date)

View File

@@ -122,7 +122,7 @@ def get_report_summary(data):
if not data:
return None
avg_completion = sum([project.percent_complete for project in data]) / len(data)
avg_completion = sum(project.percent_complete for project in data) / len(data)
total = sum([project.total_tasks for project in data])
total_overdue = sum([project.overdue_tasks for project in data])
completed = sum([project.completed_tasks for project in data])