Example #1
0
        /// <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);
        }
Example #2
0
        /// <summary>
        /// In addition to the automatically generated NEW and UPDATED prefixes, Scout2 supports a MANUAL prefix.
        /// The bill reviewer uses MANUAL when making a change to a bill report that is sufficiently meaningful
        /// that it should be called out in the weekly report, just as NEW and UPDATED are called out.
        ///
        /// The bill reviewer indicates this manual report change by including the bill measure, eg AB1234,
        /// in Scout2/ConfigurationData/NewManualRouting.json.  That file has the form
        /// [
        ///   "AB1946", "AB2025", "SB66", "SB360", "SB582", "SB590", "SB803", "SB855"
        /// ]
        /// </summary>
        /// <param name="measure">The measure number, e.g. "AB1234"</param>
        /// <returns></returns>
        internal static string CheckManualUpdate(string _measure)
        {
            const string prefix_manual = "<span style=\"color: #ff0000\">MANUAL</span><br />";

            if (Config.Instance.ManualCommitteeChanges is null)
            {
                return(string.Empty);
            }
            if (CommonUtils.IsNullOrEmptyOrWhiteSpace(_measure))
            {
                return(string.Empty);
            }
            var measure        = BillUtils.NoDash(_measure);
            var changes        = Config.Instance.ManualCommitteeChanges;
            var end_of_section = changes.FirstOrDefault(t => t == measure);

            return(end_of_section != null ? prefix_manual : string.Empty);
        }
Example #3
0
        /// <summary>
        /// Given a bill report, returns the contents of the report as a single string.
        /// This is not unit tested.  It is too simple to require testing and the necessary mock isn't worth the effort.
        /// </summary>
        /// <param name="report">BillReport telling chamber and bill number, specifying bill, allowing bill report to be read</param>
        /// <returns></returns>
        public static string ContentsFromBillReport(BillReport report)
        {
            string path = $"{Path.Combine(Config.Instance.HtmlFolder, BillUtils.EnsureNoLeadingZerosBill(report.Measure))}.html";

            return(FileUtils.FileContents(path));
        }