Skip to content

Commit

Permalink
Merge pull request #1 from PoliceScorecard/staging
Browse files Browse the repository at this point in the history
v1.2.0 Release
  • Loading branch information
manifestinteractive authored Sep 21, 2022
2 parents 5da5ade + 7021434 commit 2467059
Show file tree
Hide file tree
Showing 61 changed files with 1,385 additions and 191 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ bootstrap/cache
storage/framework/cache
storage/logs
dist
!police-scorecard.code-workspace
!.nvmrc
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.12.0
70 changes: 37 additions & 33 deletions app/Helpers.php

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions app/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ public function fetchLocationScorecard($state, $type, $location = null) {
: $this->makeRequest("scorecard/report/{$state}/{$type}");
}

/**
* Fetch State Overview
*
* <code>
* $api = new ApiController();
* $scorecard = api->fetchStateOverview('ny');
* </code>
*
* @param $state
* @return mixed
*/
public function fetchStateOverview($state) {
return $this->makeRequest("scorecard/overview/{$state}");
}

/**
* Fetch Scorecard Grades for a Given Location
*
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/WebController.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ public function usSheriffDepartment() {

public function state($state) {
$api = new ApiController();
$grades = $api->fetchGrades($state, 'police-department');
$scorecard = $api->fetchLocationScorecard($state, 'police-department');
$grades = $api->fetchGrades($state, 'state');
$scorecard = $api->fetchStateOverview($state);
$stateData = $api->fetchStateData($state);
$states = $api->fetchStates();
$total = getStateTotal($states, $state);
$location = $scorecard['agency']['slug'];

return view('report', [
return view('state', [
'title' => "Police Scorecard: {$scorecard['geo']['state']['name']}",
'description' => "Get the facts about police violence and accountability in {$scorecard['geo']['state']['name']}. Evaluate each department and hold them accountable at PoliceScorecard.org",
'grades' => sortGrades($grades),
Expand All @@ -233,7 +233,7 @@ public function state($state) {
'state' => $state,
'states' => $states,
'stateData' => $stateData,
'type' => 'police-department',
'type' => 'state',
'total' => $total
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ApproachTitle extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartArrestsByType extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartArrestsByYear extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartArrestsLowLevel extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartDisparitiesLowLevel extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartHomicidesUnsolved extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartHomicidesUnsolvedByRace extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/View/Components/Partial/Jail/ChartDeathsInJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartDeathsInJail extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/View/Components/Partial/Jail/ChartTransferredToIce.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartTransferredToIce extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class AccountabilityTitle extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartAllegedCrimes extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartCivilianComplaints extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartMisconduct extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartPoliceDiscrimination extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartUseOfForce extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartFundsSpent extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ class ChartFundsTaken extends Component
{
public $location;
public $scorecard;
public $type;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct($location = null, $scorecard = [])
public function __construct($location = null, $scorecard = [], $type = null)
{
$this->location = $location;
$this->scorecard = $scorecard;
$this->type = $type;
}

/**
Expand Down
Loading

0 comments on commit 2467059

Please sign in to comment.