Skip to content

Commit

Permalink
Merge pull request #63 from deanblackborough/v2.00.1
Browse files Browse the repository at this point in the history
v2.01.1
  • Loading branch information
deanblackborough committed Feb 3, 2023
2 parents 93f5238 + dcb148d commit b6cd51f
Show file tree
Hide file tree
Showing 12 changed files with 987 additions and 963 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

COMPOSE_PROJECT_NAME="Costs to Expect Website"
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

The complete changelog for the Costs to Expect Website, our changelog follows the format defined at https://keepachangelog.com/en/1.0.0/

## [v2.01.1] - 2023-03-03
### Changed
- We have updated all back end dependencies.
- We have removed the app from the side panel and added links to Budget and Budget Pro.

### Fixed
- We have implemented a minor tweak to try and correct the occasional 500 error

## [v2.01.0] - 2022-06-17
### Changed
- We have updated the website to target v3 of the Costs to Expect API.
Expand Down
27 changes: 15 additions & 12 deletions app/Http/Controllers/ChildController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,22 @@ private function childModel(string $name): Child
{
if ($name === 'niall') {
return new Niall();
} else {
return new Jack();
}

return new Jack();
}

public function jack()
public function jack(): View
{
return $this->child('jack');
}

public function niall()
public function niall(): View
{
return $this->child('niall');
}

/**
* Overview page for each child
*
* @param string $child
*
* @return View
*/
public function child($child): View
public function child(string $child): View
{
Api::resetCalledURIs();

Expand Down Expand Up @@ -566,6 +559,11 @@ public function year(Request $request, string $child, string $year): View

foreach ($monthly_summary_data as $month) {
$month['total'] = 0;

if (array_key_exists('subtotals', $month) === false) {
continue;
}

foreach ($month['subtotals'] as $subtotal) {
if ($subtotal['currency']['code'] === 'GBP') {
$month['total'] = $subtotal['subtotal'];
Expand Down Expand Up @@ -645,6 +643,11 @@ public function month(Request $request, string $child, string $year, string $mon

foreach ($monthly_summary_data as $month_subtotals) {
$month_subtotals['total'] = 0;

if (array_key_exists('subtotals', $month_subtotals) === false) {
continue;
}

foreach ($month_subtotals['subtotals'] as $subtotal) {
if ($subtotal['currency']['code'] === 'GBP') {
$month_subtotals['total'] = $subtotal['subtotal'];
Expand Down
4 changes: 2 additions & 2 deletions app/Models/Child.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function totalNumberOfExpenses(): int

if (array_key_exists('X-Total-Count', $this->expenses_headers) === true) {
return (int) $this->expenses_headers['X-Total-Count'][0];
} else {
return 0;
}

return 0;
}

protected function expensesHeaders(): array
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"type": "project",
"description": "The public website for the Costs to Expect service, tracks costs to raise our children to adulthood",
"keywords": [
"failmy-data",
"family data",
"costs to expect",
"costs-to-expect",
"child-costs",
"uk"
Expand Down
Loading

0 comments on commit b6cd51f

Please sign in to comment.