Permalink
Browse files

Use year instead of session in calendar spotcheck

The nysenate.gov spotcheck checks all openleg bills in the same session
year as the given calendar dump.  This is incorrect as the dump contains
calendars for a single year.

This commit restricts the openleg calendars checked to those in the year
of the given nysenate.gov calendar dump.
  • Loading branch information...
McSquirrel committed Oct 31, 2017
1 parent 1f0e69c commit a60cfb8f0d9e64572b46c14e8486fa47d0b92dca
@@ -1,7 +1,5 @@
package gov.nysenate.openleg.service.spotcheck.senatesite.calendar;
import gov.nysenate.openleg.dao.base.LimitOffset;
import gov.nysenate.openleg.dao.base.SortOrder;
import gov.nysenate.openleg.dao.bill.reference.senatesite.SenateSiteDao;
import gov.nysenate.openleg.dao.calendar.data.CalendarUpdatesDao;
import gov.nysenate.openleg.dao.spotcheck.CalendarEntryListIdSpotCheckReportDao;
@@ -24,12 +22,13 @@
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static gov.nysenate.openleg.dao.base.LimitOffset.ALL;
import static gov.nysenate.openleg.dao.base.SortOrder.ASC;
import static gov.nysenate.openleg.model.spotcheck.SpotCheckRefType.SENATE_SITE_CALENDAR;
/**
@@ -62,10 +61,7 @@ public SpotCheckRefType getSpotcheckRefType() {
try {
//Get openleg calendars for session
List<Calendar> openlegCalendars = dumpId.getSession().asYearList().stream()
.map(year -> calendarDataService.getCalendars(year, SortOrder.ASC, LimitOffset.ALL))
.flatMap(Collection::stream)
.collect(Collectors.toList());
List<Calendar> openlegCalendars = calendarDataService.getCalendars(dumpId.getYear(), ASC, ALL);
// Parse senate site calendars from dump
List<SenateSiteCalendar> senSiteCalendars = calendarJsonParser.parseCalendars(calendarDump);

0 comments on commit a60cfb8

Please sign in to comment.