public static double GetCurrentGrowthFactor(ICoronaEntry now, ICoronaEntry today, ICoronaEntry yesterday) { var todayGrowth = GetGrowthFactor(now, today); var yesteredayGrowth = GetGrowthFactor(today, yesterday); var moreToday = todayGrowth > yesteredayGrowth; return(moreToday ? todayGrowth : yesteredayGrowth); }
public static double GetGrowthFactor(ICoronaEntry current, ICoronaEntry past) { var res = (double)current.CaseIncrease / past.CaseIncrease; if (double.IsNaN(res)) { return(0); } return(res); }