Skip to content

Commit

Permalink
Add some guardrails to the fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
waldoj committed Dec 29, 2023
1 parent a666e4a commit 685582d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cron/legislators.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@

$log->put('Retrieved ' . count($senators) . ' senators from senate.virginia.gov.', 1);

if (count($senators) < 35)
{
$log->put('Since too few senators were found to be plausible, abandoning efforts.', 5);
return;
}

/*
* Get delegates. Their House ID (e.g., "H0200") is the key, their name is the value.
*/
Expand All @@ -103,6 +109,12 @@

$log->put('Retrieved ' . count($delegates) . ' delegates from virginiageneralassembly.gov.', 1);

if (count($delegates) < 90)
{
$log->put('Since too few delegates were found to be plausible, abandoning efforts.', 5);
return;
}

/*
* Invoke the Import class.
*/
Expand Down

0 comments on commit 685582d

Please sign in to comment.