/// <summary> /// In the "Highest Priority", "Oppose", "Modify/Monitor" and "Prediction" sections of the weekly report, bills that are /// new or have been updated are shown with a red prefix of NEW or UPDATED. This makes them stand out from all the /// other bills listed in the report. /// /// If the bill's first review date was during this past week, the NEW prefix is shown. /// if the date of the bill's last action was during this past week, the UPDATED prefix is shown. /// </summary> /// <param name="past_week">Starting and ending dates of the previous week</param> /// <param name="report">The contents of an individual bill report</param> /// <returns></returns> public static string NewOrChangePrefix(WeeklyReport.WeeklyReport.DateRange past_week, BillReport report) { const string prefix_new = "<span style=\"color: #ff0000\">NEW</span><br />"; const string prefix_update = "<span style=\"color: #ff0000\">UPDATED</span><br />"; string report_contents = BillUtils.ContentsFromBillReport(report); string prefix = BillUtils.IsNewThisWeek(report_contents, past_week) ? prefix_new : string.Empty; if (prefix.Length == 0) { var dt = DateFromLastAction(report); prefix = DateUtils.DateIsInPastWeek(dt, past_week) ? prefix_update : CheckManualUpdate(report.Measure); } return(prefix); }
/// <summary> /// Answers whether an individual bill report appears for the first time this week. /// The bill review date is given on the summary line, e.g. Summary: (Reviewed 1/19/2019) /// </summary> /// <param name="report_contents">The contents of the individual bill report in question</param> /// <param name="past_week">The starting and ending dates that define last week.</param> /// <returns></returns> public static bool IsNewThisWeek(string report_contents, WeeklyReport.WeeklyReport.DateRange past_week) { DateTime dt = DateOfInitialReview(report_contents); return(DateUtils.DateIsInPastWeek(dt, past_week)); }
public static bool DateIsInPastWeek(DateTime dt, WeeklyReport.WeeklyReport.DateRange range) { return(dt >= range.start && dt <= range.end); }