fix: show avg time number card based on closed_on date
This commit is contained in:
parent
9b1d4832b6
commit
eddf8c9295
@ -274,9 +274,9 @@ def get_average_time_to_close(from_date, to_date, conds="", return_result=False)
|
||||
result = frappe.db.sql(
|
||||
f"""
|
||||
SELECT
|
||||
AVG(CASE WHEN d.creation >= %(from_date)s AND d.creation < DATE_ADD(%(to_date)s, INTERVAL 1 DAY)
|
||||
AVG(CASE WHEN d.closed_on >= %(from_date)s AND d.closed_on < DATE_ADD(%(to_date)s, INTERVAL 1 DAY)
|
||||
THEN TIMESTAMPDIFF(DAY, COALESCE(l.creation, d.creation), d.closed_on) END) as current_avg,
|
||||
AVG(CASE WHEN d.creation >= %(prev_from_date)s AND d.creation < %(prev_to_date)s
|
||||
AVG(CASE WHEN d.closed_on >= %(prev_from_date)s AND d.closed_on < %(prev_to_date)s
|
||||
THEN TIMESTAMPDIFF(DAY, COALESCE(l.creation, d.creation), d.closed_on) END) as prev_avg
|
||||
FROM `tabCRM Deal` d
|
||||
LEFT JOIN `tabCRM Lead` l ON d.lead = l.name
|
||||
|
||||
@ -8,13 +8,6 @@
|
||||
</div>
|
||||
<div class="flex-1 overflow-y-auto">
|
||||
<div class="mb-3 flex flex-col">
|
||||
<SidebarLink
|
||||
:label="__('Dashboard')"
|
||||
:icon="LucideLayoutDashboard"
|
||||
:to="'Dashboard'"
|
||||
:isCollapsed="isSidebarCollapsed"
|
||||
class="mx-2 my-0.5"
|
||||
/>
|
||||
<SidebarLink
|
||||
id="notifications-btn"
|
||||
:label="__('Notifications')"
|
||||
@ -205,6 +198,11 @@ const isFCSite = ref(window.is_fc_site)
|
||||
const isDemoSite = ref(window.is_demo_site)
|
||||
|
||||
const links = [
|
||||
{
|
||||
label: 'Dashboard',
|
||||
icon: LucideLayoutDashboard,
|
||||
to: 'Dashboard',
|
||||
},
|
||||
{
|
||||
label: 'Leads',
|
||||
icon: LeadsIcon,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user