Skip to content

Commit

Permalink
Issue krayin#704 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jitendra-webkul committed Nov 15, 2021
1 parent 01e6b03 commit f7ba12a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/Webkul/Admin/src/Helpers/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public function getActivities($startDateFilter, $endDateFilter, $totalWeeks)
public function getTopLeads($startDateFilter, $endDateFilter, $totalWeeks)
{
$topLeads = $this->leadRepository
->select('leads.*', 'title', 'lead_value as amount', 'leads.created_at', 'status', 'lead_pipeline_stages.name as statusLabel')
->select('leads.id', 'title', 'lead_value as amount', 'leads.created_at', 'status', 'lead_pipeline_stages.name as statusLabel')
->leftJoin('lead_pipeline_stages', 'leads.lead_pipeline_stage_id', '=', 'lead_pipeline_stages.id')
->orderBy('lead_value', 'desc')
->whereBetween('leads.created_at', [$startDateFilter, $endDateFilter])
Expand Down Expand Up @@ -574,7 +574,7 @@ public function getEmails($startDateFilter, $endDateFilter, $totalWeeks)
public function getTopCustomers($startDateFilter, $endDateFilter, $totalWeeks)
{
$topCustomers = $this->leadRepository
->select('leads.*', 'persons.id as personId', 'persons.name as label', DB::raw("(COUNT(*)) as count"))
->select('persons.id as personId', 'persons.name as label', DB::raw("(COUNT(*)) as count"))
->leftJoin('persons', 'leads.person_id', '=', 'persons.id')
->whereBetween('leads.created_at', [$startDateFilter, $endDateFilter])
->groupBy('person_id')
Expand Down
12 changes: 0 additions & 12 deletions packages/Webkul/Lead/src/Models/Lead.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,4 @@ public function getRottenDaysAttribute()

return $rottenDate->diffInDays(Carbon::now(), false);
}

/**
* @return array
*/
public function toArray()
{
$array = parent::toArray();

$array['rotten_days'] = $this->rotten_days;

return $array;
}
}
1 change: 1 addition & 0 deletions packages/Webkul/Lead/src/Repositories/LeadRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function getLeads($pipelineId, $term, $createdAtRange)
'lead_pipeline_stages.name as status',
'lead_pipeline_stages.id as lead_pipeline_stage_id'
)
->addSelect(\DB::raw('DATEDIFF(leads.created_at + INTERVAL lead_pipelines.rotten_days DAY, now()) as rotten_days'))
->leftJoin('persons', 'leads.person_id', '=', 'persons.id')
->leftJoin('lead_pipelines', 'leads.lead_pipeline_id', '=', 'lead_pipelines.id')
->leftJoin('lead_pipeline_stages', 'leads.lead_pipeline_stage_id', '=', 'lead_pipeline_stages.id')
Expand Down

0 comments on commit f7ba12a

Please # to comment.