Skip to content

Commit

Permalink
Fix overall vote count; add sample count.
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Jan 4, 2019
1 parent 85de714 commit ce20d55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions app/Petition.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public function fetchJobs()
return $this->hasMany(FetchJob::class);
}

public function latestFetchJobs()
{
return $this->hasMany(FetchJob::class)->latest();
}

/**
* @returns PetitionData object from the stored metadata
*/
Expand Down
19 changes: 13 additions & 6 deletions resources/views/charts/simple-overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</tr>
<tr>
<th scope="row">Total Votes</td>
<td>{{ $petition->getPetitionData()->getCount() }}</td>
<td>{{ $petition->fetchJobs()->latest()->first()->count }}</td>
</tr>
<tr>
<th scope="row">State</td>
Expand All @@ -61,10 +61,6 @@
{!! Markdown::convertToHtml($petition->getPetitionData()->getAdditionalDetails()) !!}
</td>
</tr>
<tr>
<th scope="row">Monitor Period</td>
<td>{{ $petition->getScheduleName() }}</td>
</tr>
<tr>
<th scope="row">Petition Home Page</td>
<td><a href="{{ $petition->getPetitionData()->getHtmlUrl() }}" rel="external">
Expand All @@ -77,8 +73,19 @@
{{ $petition->getPetitionData()->getJsonUrl() }}
</a></td>
</tr>
<tr>
<th scope="row">Monitor Period</td>
<td>{{ $petition->getScheduleName() }}</td>
</tr>
<tr>
<th scope="row">Samples</td>
<td>
{{ $petition->fetchJobs()->count() }}
since
{{ $petition->fetchJobs()->oldest()->first()->created_at }}
</td>
</tr>
</table>
<?php //dump($petition->toArray()); ?>
@endif
</div>

Expand Down

0 comments on commit ce20d55

Please sign in to comment.