mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 03:01:22 +00:00
perf(minor): remove unnecessary comprehensions (port #25645)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user