public async Task <dynamic> GetDailyScrapByShift(
            DailyScrapByShiftResourceParameter resourceParams
            )
        {
            var summary = await GetDailyScrapByShiftList(resourceParams).ConfigureAwait(false);

            var distinctShift = summary
                                .Select(x => new { x.Shift, x.ShiftOrder })
                                .Distinct()
                                .ToList();

            //get scrap data each day by filtered date range
            var result    = new List <dynamic>();
            var tempStart = resourceParams.Start;

            while (tempStart <= resourceParams.End)
            {
                foreach (var shift in distinctShift.OrderBy(x => x.ShiftOrder))
                {
                    var isExist = summary.Any(
                        x => x.ShiftDate == tempStart && x.Shift == shift.Shift
                        );
                    if (isExist)
                    {
                        var data = summary.First(
                            x => x.ShiftDate == tempStart && x.Shift == shift.Shift
                            );
                        result.Add(
                            new
                        {
                            data.ShiftDate,
                            data.Shift,
                            data.ShiftOrder,
                            data.ScrapCode,
                            data.ScrapDesc,
                            data.Qty
                        }
                            );
                    }
                    else
                    {
                        result.Add(
                            new
                        {
                            ShiftDate = tempStart,
                            shift.Shift,
                            shift.ShiftOrder,
                            resourceParams.ScrapCode,
                            ScrapDesc = "",
                            Qty       = 0
                        }
                            );
                    }
                }
                tempStart = tempStart.AddDays(1);
            }

            //group by shift
            var shifts = distinctShift.Select(
                x =>
                new
            {
                shift      = x.Shift,
                shiftOrder = x.ShiftOrder,
                dailyScrap = new
                {
                    data      = result.Where(s => s.Shift == x.Shift),
                    trendline = TrendLine.GetTrendLine(
                        result.Where(s => s.Shift == x.Shift),
                        "Qty"
                        )
                }
            }
                );

            return(new
            {
                AllShifts = new
                {
                    trendline = TrendLine.GetTrendLine(result, "Qty"),
                    data = result
                },
                Shift = shifts
            });
        }