Skip to content

Commit ee2004f

Browse files
author
Marcel Schmidt
committed
(dashboard) orders chart > fixed faulty week display
1 parent 6b737cc commit ee2004f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Presentation/SmartStore.Web/Administration/Controllers/OrderController.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,6 @@ public ActionResult LatestOrdersDashboardReport()
27962796
return PartialView(model);
27972797
}
27982798

2799-
28002799
[NonAction]
28012800
protected void SetOrderReportData(List<DashboardChartReportModel> reports, OrderDataPoint dataPoint)
28022801
{
@@ -2837,21 +2836,21 @@ protected void SetOrderReportData(List<DashboardChartReportModel> reports, Order
28372836
today.Amount[dataPoint.CreatedOn.Hour] += dataPoint.OrderTotal;
28382837
today.Quantity[dataPoint.CreatedOn.Hour]++;
28392838
// Ignore yesterday if today
2840-
week.Amount[reports[2].DataSets[0].Amount.Length - 1] += dataPoint.OrderTotal;
2841-
week.Quantity[reports[2].DataSets[0].Quantity.Length - 1]++;
2839+
week.Amount[6] += dataPoint.OrderTotal;
2840+
week.Quantity[6]++;
28422841
}
28432842
else if (periodStatus == PeriodState.Yesterday)
28442843
{
28452844
// Ignore today if yesterday
28462845
reports[1].DataSets[dataIndex].Amount[dataPoint.CreatedOn.Hour] += dataPoint.OrderTotal;
28472846
reports[1].DataSets[dataIndex].Quantity[dataPoint.CreatedOn.Hour]++;
2848-
reports[2].DataSets[dataIndex].Amount[reports[2].DataSets[0].Amount.Length - 2] += dataPoint.OrderTotal;
2849-
reports[2].DataSets[dataIndex].Quantity[reports[2].DataSets[0].Quantity.Length - 2]++;
2847+
reports[2].DataSets[dataIndex].Amount[5] += dataPoint.OrderTotal;
2848+
reports[2].DataSets[dataIndex].Quantity[5]++;
28502849
}
28512850
else if (periodStatus == PeriodState.Week)
28522851
{
28532852
// Ignore today and yesterday
2854-
var weekIndex = (userTime - dataPoint.CreatedOn).Days;
2853+
var weekIndex = 6 - (userTime - dataPoint.CreatedOn).Days;
28552854
reports[2].DataSets[dataIndex].Amount[weekIndex] += dataPoint.OrderTotal;
28562855
reports[2].DataSets[dataIndex].Quantity[weekIndex]++;
28572856
}

0 commit comments

Comments
 (0)