Skip to content

Commit

Permalink
Add documentation for hasTextInFormat BillAmendment method
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinCaseiras committed May 24, 2019
1 parent 229f0ce commit 982cc52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public ImmutableSet<BillTextFormat> getFullTextFormats() {
return ImmutableSet.copyOf(fullTextMap.keySet());
}

/**
* Checks that a {@link BillTextFormat} has been loaded for this amendment.
* This method does not care if the text for a format is null or empty, just that it has been loaded.
*/
public boolean hasTextInFormat(BillTextFormat format) {
return fullTextMap.containsKey(format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void run() {
* Returns a version of the given bill that is guaranteed to contain plaintext versions of full text for all amendments
*/
private Bill ensurePlainTextPresent(Bill bill) {
boolean allContainPlain = bill.getAmendmentList().stream().allMatch(a -> a.getFullTextFormats().contains(PLAIN));
boolean allContainPlain = bill.getAmendmentList().stream().allMatch(a -> a.hasTextInFormat(PLAIN));
if (!allContainPlain) {
// If the bill doesn't have plain text for any amendments, reload bill with plain text
logger.warn("Bill passed in for indexing does not contain plain text: {}", bill.getBaseBillId());
Expand Down

0 comments on commit 982cc52

Please sign in to comment.