public ExitCode DailySummary(DailySummaryOptions opts) { return(FetchData(opts.Username, opts.Password, opts.DateRange) .Map(foods => foods .GroupBy(y => y.Date) .Select(grp => new { Date = grp.Key.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), Calories = Math.Round(SumEnergy(grp.Select(x => x.Energy)).Calories), Protein = Math.Round(SumMass(grp.Select(x => x.Protein)).Grams), Carbs = Math.Round(SumMass(grp.Select(x => x.Carbohydrates)).Grams), Fat = Math.Round(SumMass(grp.Select(x => x.Fat)).Grams), }) .Then(opts.OutputWriter(_output).Write)) .Match( Left: _ => _, Right: _ => ExitCode.Success));
public ExitCode DailySummary(DailySummaryOptions opts) => TrackEvent(opts, () => _other.DailySummary(opts));