Skip to content

Commit

Permalink
Merge pull request #795 from neontribe/upgrade-prep-reconcile-into-de…
Browse files Browse the repository at this point in the history
…v-part2

Upgrade prep reconcile into dev part2
  • Loading branch information
charlesstrange2 authored Jan 14, 2025
2 parents a7f43b2 + 3e95d9a commit 31c7015
Show file tree
Hide file tree
Showing 201 changed files with 7,622 additions and 6,615 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ DB_TESTING_MYSQL_USERNAME=homestead
DB_TESTING_MYSQL_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
CACHE_STORE=file
SESSION_DRIVER=file
QUEUE_DRIVER=database
QUEUE_CONNECTION=database

# Set this to true for production envs
SESSION_SECURE_COOKIE=false
Expand Down
12 changes: 4 additions & 8 deletions .env.ghactions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_DEBUG="true"
APP_ENV="local"
APP_KEY=base64:tgXIsT9WKaX080QNySMgPEROzNa+mc5jWFK7PtJQ+/g=
APP_KEY=
APP_LOG_LEVEL="debug"
APP_NAME="ARCVService"
APP_SEEDS="Dev"
Expand All @@ -12,14 +12,10 @@ ARC_SCHOOL_MONTH="9"
ARC_SERVICE_DOMAIN="arcv-service.test"
ARC_STORE_DOMAIN="arcv-store.test"
BROADCAST_DRIVER="log"
CACHE_DRIVER="file"
CACHE_STORE="file"
DB_CONNECTION="sqlite"
#DB_HOST="127.0.0.1"
#DB_PORT="3396"
DB_DATABASE="/tmp/data.db"
#DB_PASSWORD="arcv"
#DB_USERNAME="arcv"
MAIL_DRIVER="log"
MAIL_MAILER="log"
MAIL_ENCRYPTION="null"
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="Mailer Name"
Expand All @@ -33,6 +29,6 @@ MAIL_TO_DEVELOPER_TEAM="[email protected]"
MAIL_USERNAME="null"
PASSWORD_CLIENT=1
PASSWORD_CLIENT_SECRET=0
QUEUE_DRIVER="sync"
QUEUE_CONNECTION="sync"
SESSION_DRIVER="file"
SESSION_SECURE_COOKIE="false"
37 changes: 0 additions & 37 deletions .env.travis

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Homestead.json
Homestead.yaml
npm-debug.log
.env
.env*
.prettierignore
.vscode
.DS_STORE
Expand Down
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ ENV DB_PASSWORD=secret
ENV BROADCAST_DRIVER=log
ENV CACHE_DRIVER=file
ENV SESSION_DRIVER=file
ENV QUEUE_DRIVER=database
ENV QUEUE_CONNECTION=database
ENV SESSION_SECURE_COOKIE=false
ENV MAIL_MAILER=log
ENV MAIL_HOST=smtp.mailtrap.io
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Licence - The Laravel framework is open-sourced software licensed under the MIT
Third Party Packages
- https://github.com/barryvdh/laravel-cors MIT Licence https://github.com/barryvdh/laravel-cors/blob/master/LICENSE
- https://github.com/barryvdh/laravel-dompdf MIT Licence https://opensource.org/licenses/MIT
- https://github.com/doctrine/dbal MIT Licence https://github.com/doctrine/dbal/blob/master/LICENSE
- https://github.com/moontoast/math Apache Licence 2.0 https://github.com/moontoast/math/blob/master/LICENSE
- https://github.com/esbenp/laravel-api-consumer None Stated
- https://github.com/ramsey/uuid MIT Licence https://github.com/ramsey/uuid/blob/master/LICENSE
Expand Down
14 changes: 3 additions & 11 deletions app/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class Bundle extends Model
* @var array
*/
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'disbursed_at' => 'datetime', // When it was handed out.
];

/**
Expand All @@ -64,17 +67,6 @@ class Bundle extends Model
protected $appends = [
];

/**
* These are turned into Date objects on get
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
'disbursed_at' // When it was handed out.
];

/**
* Adds voucher codes to a bundle
* @param $voucherCodes
Expand Down
3 changes: 1 addition & 2 deletions app/CentreUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class CentreUser extends Authenticatable
use Notifiable;
use SoftDeletes;

protected $dates = ['deleted_at'];

protected $guard = 'store';

/**
Expand Down Expand Up @@ -65,6 +63,7 @@ class CentreUser extends Authenticatable
*/
protected $casts = [
'downloader' => 'boolean',
'deleted_at' => 'datetime',
];

/**
Expand Down
30 changes: 11 additions & 19 deletions app/Child.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
* @property string $dob
* @property Carbon $dob
* @property bool $born
* @property bool $verified
* @property bool $defer
Expand Down Expand Up @@ -50,21 +50,10 @@ class Child extends Model implements IEvaluee
protected $hidden = [];

/**
* These are turned into Date objects on get
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
'dob'
];

/**
* The attributes that should be appended.
*
* @var array
*/
* The attributes that should be appended.
*
* @var array
*/
protected $appends = ['can_defer'];

/**
Expand All @@ -74,7 +63,7 @@ class Child extends Model implements IEvaluee
*/
public function getEvaluator(): AbstractEvaluator
{
if ($this->has('family')) {
if (!empty($this->family)) {
return $this->family->getEvaluator();
}
$this->_evaluator = ($this->_evaluator) ?? EvaluatorFactory::make();
Expand All @@ -87,6 +76,9 @@ public function getEvaluator(): AbstractEvaluator
* @var array
*/
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'dob' => 'datetime',
'verified' => 'boolean',
'deferred' => 'boolean',
];
Expand All @@ -97,7 +89,7 @@ public function getEvaluator(): AbstractEvaluator
* @param string $format
* @return string
*/
public function getAgeString(string $format = '%y yr, %m mo') : string
public function getAgeString(string $format = '%y yr, %m mo'): string
{
$currentDate = Carbon::now();
$startOfMonth = Carbon::now()->startOfMonth();
Expand Down Expand Up @@ -142,7 +134,7 @@ public function calcFutureMonthYear(int $years, int $month = null): Carbon
// If we're born BEFORE the month
$years = ($this->dob->month < $month)
// ... then we'll start one year earlier
? $years -1
? $years - 1
// ... else we're a late starter and it'll be the number given.
: $years
;
Expand Down
40 changes: 20 additions & 20 deletions app/Console/Commands/CreateMasterVoucherLogReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Console\Commands;

use App\Services\TextFormatter;
use DateTime;
use DB;
use Exception;
Expand All @@ -12,8 +11,8 @@
use Log;
use PDO;
use ZipStream\Exception\OverflowException;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use App\Wrappers\SecretStreamWrapper;

class CreateMasterVoucherLogReport extends Command
{
Expand Down Expand Up @@ -80,7 +79,7 @@ class CreateMasterVoucherLogReport extends Command
* The date that we care about for last year's data.
* @var string $cutOffDate
*/
private string $cutOffDate;
private string $cutOffDate = '2023-09-01';

/**
* @var ZipStream $za;
Expand All @@ -90,7 +89,7 @@ class CreateMasterVoucherLogReport extends Command
private $zaOutput;

// Excel can't deal with large CSVs
const ROW_LIMIT = 900000;
const ROW_LIMIT = 950000;

/**
* The report's query template
Expand Down Expand Up @@ -195,7 +194,7 @@ public function __construct()
// Enable the secret stream protocol (ssw://). See SecretStreamWrapper for more information.
// Registering here guarantees availability but there's probably a more Laravel-y place to put this.
if (!in_array("ssw", stream_get_wrappers())) {
stream_wrapper_register("ssw", "App\Wrappers\SecretStreamWrapper");
stream_wrapper_register("ssw", SecretStreamWrapper::class);
}

$this->archiveName = config('arc.mvl_filename');
Expand All @@ -208,7 +207,7 @@ public function initSettings() : void
{
$thisYearsApril = Carbon::parse('april')->startOfMonth();
$years = ($thisYearsApril->isPast()) ? 2 : 1;
$this->cutOffDate = $thisYearsApril->subYearsNoOverflow($years)->format('Y-m-d');
// $this->cutOffDate = $thisYearsApril->subYearsNoOverflow($years)->format('Y-m-d');

// Set the disk
$this->disk = ($this->option('plain'))
Expand All @@ -225,10 +224,12 @@ public function initSettings() : void
}

// Stream directly to what is either a file or a file wrapped in a secret stream.
$options = new Archive();
$this->zaOutput = fopen($path, 'w');
$options->setOutputStream($this->zaOutput);
$this->za = new ZipStream(null, $options);
$this->za = new ZipStream(
outputStream: $this->zaOutput,
sendHttpHeaders: false,
outputName: null
);
}
}

Expand Down Expand Up @@ -411,17 +412,16 @@ public function rejectThisVoucher($voucher) : bool
// are all the fields we care about null?
$this->containsOnlyNull($voucher) ||
// is this date filled?
!is_null($voucher['Void Voucher Date']);
// ||
// // is this date dilled *and* less than the cut-off date
// (!is_null($voucher['Reimbursed Date']) &&
// strtotime(
// DateTime::createFromFormat(
// 'd/m/Y',
// $voucher['Reimbursed Date']
// )->format('Y-m-d')
// ) < strtotime($this->cutOffDate)
// );
!is_null($voucher['Void Voucher Date']) ||
// is this date filled *and* less than the cut-off date
(!is_null($voucher['Reimbursed Date']) &&
strtotime(
DateTime::createFromFormat(
'd/m/Y',
$voucher['Reimbursed Date']
)->format('Y-m-d')
) < strtotime($this->cutOffDate)
);
}

/**
Expand Down
Loading

0 comments on commit 31c7015

Please sign in to comment.