Skip to content

Commit 3b74631

Browse files
committed
Merge branch 'master' into #355-2fa
# Conflicts: # Vagrantfile # composer.json # composer.lock # resources/views/layouts/navbar.blade.php # routes/console.php
2 parents fee7dd6 + 22b340a commit 3b74631

File tree

159 files changed

+7249
-1859
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+7249
-1859
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Homestead.yaml
1313
npm-debug.log
1414
yarn-error.log
1515
.env
16+
.env.backup
1617
database/database.sqlite
1718
.phpunit.result.cache
1819

@@ -32,4 +33,6 @@ Thumbs.db
3233
mixwatch.log
3334
/public/mix-manifest.json
3435
/storage/proxies
35-
/version
36+
/version
37+
/laravel-echo-server.json
38+
laravel-echo-server.lock

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Version 2 of our Hackspace Management System
33

44
[![Build Status](https://travis-ci.org/NottingHack/hms2.svg?branch=master)](https://travis-ci.org/NottingHack/hms2)
55

6+
## Cloning
7+
We use submodules, either clone them with this repo
8+
`git clone --recurse-submodules [email protected]:NottingHack/hms2.git`
9+
or after
10+
`git submodule update --init`
11+
612
## Hosts File
713

814
Most of the development environment is taken care of by vagrant, you just need to `vagrant up` to load it.
@@ -33,3 +39,11 @@ When re-provisioning the box (`vagrnat up`) you must make sure that the `.env` f
3339

3440
If the `mailserver.mailbox` tables it empty you can do a datebase reset and reseed with `dev/reseed.sh`
3541

42+
## Vagrant suspend notes
43+
44+
When bringing up vagrant box after a suspend or halt some of the service my not start correctly due to the shared folder, run this script to restart them
45+
46+
`dev/restartservices`
47+
48+
## Serving
49+
ngrok http https://hmsdev:443

Vagrantfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
1111

1212
# Every Vagrant virtual environment requires a box to build off of.
1313
config.vm.box = "NottingHack/hms2"
14-
config.vm.box_version = ">=1.3.0"
14+
config.vm.box_version = ">=1.4.0"
1515
config.vm.hostname = "hmsdev.nottingtest.org.uk"
1616

1717
config.vm.provider :virtualbox do |vb|
@@ -27,13 +27,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
2727
config.vm.provision :shell, path: "dev/vagrant-config/scripts/mix.sh", privileged: false
2828
config.vm.provision :shell, path: "dev/vagrant-config/scripts/labelprinter.sh"
2929
config.vm.provision :shell, path: "dev/vagrant-config/scripts/laravel-queue.sh"
30+
config.vm.provision :shell, path: "dev/vagrant-config/scripts/echo.sh"
3031
config.vm.provision :shell, path: "dev/vagrant-config/scripts/finish.sh"
3132

3233
config.vm.network "private_network", ip: "192.168.25.35"
3334

3435
config.trigger.after :up, :resume, :reload do |trigger|
3536
trigger.info = "Restaring Nginx & PHP"
36-
trigger.run_remote = {inline: "sudo systemctl restart nginx php7.2-fpm"}
37+
trigger.run_remote = {inline: "sudo systemctl restart nginx php7.2-fpm laravel-echo-server"}
3738
trigger.run_remote = {inline: "php /vagrant/artisan horizon:terminate"}
3839
end
3940

app/Charts/ElectricReadingsChart.php

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
namespace App\Charts;
4+
5+
use ConsoleTVs\Charts\Classes\Highcharts\Chart;
6+
7+
class ElectricReadingsChart extends Chart
8+
{
9+
/**
10+
* Initializes the chart.
11+
*
12+
* @param ElectricMeter[] $meters
13+
* @param array $readings
14+
*
15+
* @return void
16+
*/
17+
public function __construct($meters, $readings)
18+
{
19+
parent::__construct();
20+
21+
$this->height = 600;
22+
$this->title('Electricity usage');
23+
$this->label('kW Hours');
24+
25+
$this->options([
26+
'chart' => [
27+
'zoomType' => 'x',
28+
],
29+
'subtitle' => [
30+
'text' => 'kW hours since previous reading.',
31+
],
32+
'tooltip' => [
33+
'split' => true,
34+
'valueSuffix' => ' kW Hours',
35+
],
36+
'plotOptions' => [
37+
'area' => [
38+
'stacking' => 'normal',
39+
],
40+
],
41+
]);
42+
43+
$readings = collect($readings);
44+
45+
$readingLabels = $readings->map(function ($reading) {
46+
return $reading['date']->toDateString();
47+
});
48+
$this->labels($readingLabels);
49+
50+
$previousReading = null;
51+
52+
foreach ($meters as $meter) {
53+
$previousReading = null;
54+
$meterReadings = $readings->mapWithKeys(function ($reading) use ($meter, &$previousReading) {
55+
if (! is_null($previousReading) && ! is_null($reading[$meter->getName()])) {
56+
$unitsUsed = $reading[$meter->getName()] - $previousReading;
57+
} else {
58+
$unitsUsed = null;
59+
}
60+
$previousReading = $reading[$meter->getName()];
61+
62+
return [
63+
$reading['date']->toDateString() => $unitsUsed,
64+
];
65+
});
66+
67+
$this->dataset($meter->getName(), 'area', $meterReadings->values());
68+
}
69+
}
70+
}

app/Charts/SnackspaceDebtChart.php

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace App\Charts;
4+
5+
use ConsoleTVs\Charts\Classes\Highcharts\Chart;
6+
7+
class SnackspaceDebtChart extends Chart
8+
{
9+
/**
10+
* Initializes the chart.
11+
*
12+
* @return void
13+
*/
14+
public function __construct()
15+
{
16+
parent::__construct();
17+
18+
$this->height = 800;
19+
$this->title('Snackspace');
20+
$this->label('£');
21+
22+
$this->options([
23+
'chart' => [
24+
'zoomType' => 'x',
25+
],
26+
'subtitle' => [
27+
'text' => 'For all time, click/pinch to zoom.',
28+
],
29+
'tooltip' => [
30+
'split' => true,
31+
'valuePrefix' => '£',
32+
],
33+
]);
34+
}
35+
}

app/Console/Commands/Banking/AuditCommand.php

-43
This file was deleted.

app/Console/Commands/Database/MigrateInstrumentaionCommand.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Carbon\Carbon;
66
use HMS\Tools\ToolManager;
7+
use Illuminate\Support\Str;
78
use Illuminate\Console\Command;
89
use Illuminate\Support\Facades\DB;
910

@@ -741,13 +742,13 @@ protected function migrateMemberTools()
741742
foreach ($tools as $tool) {
742743
$toolRoleIds[$tool->id] = [
743744
'MAINTAINER' => DB::table('roles')
744-
->where('name', 'LIKE', 'tools.' . camel_case($tool->name) . '.maintainer')
745+
->where('name', 'LIKE', 'tools.' . Str::camel($tool->name) . '.maintainer')
745746
->value('id'),
746747
'INDUCTOR' => DB::table('roles')
747-
->where('name', 'LIKE', 'tools.' . camel_case($tool->name) . '.inductor')
748+
->where('name', 'LIKE', 'tools.' . Str::camel($tool->name) . '.inductor')
748749
->value('id'),
749750
'USER' => DB::table('roles')
750-
->where('name', 'LIKE', 'tools.' . camel_case($tool->name) . '.user')
751+
->where('name', 'LIKE', 'tools.' . Str::camel($tool->name) . '.user')
751752
->value('id'),
752753
];
753754
}

app/Console/Commands/Members/YoungHackerAuditCommand.php

-43
This file was deleted.

app/Console/Kernel.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
namespace App\Console;
44

5+
use App\Jobs\EmailTeamReminderJob;
56
use App\Jobs\Snackspace\LogDebtJob;
7+
use App\Jobs\Banking\MembershipAuditJob;
68
use Illuminate\Console\Scheduling\Schedule;
79
use App\Jobs\GateKeeper\ZoneOccupantResetJob;
10+
use App\Jobs\Membership\AuditYoungHackersJob;
11+
use App\Jobs\Snackspace\MemberDebtNotificationJob;
812
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
913

1014
class Kernel extends ConsoleKernel
@@ -30,11 +34,11 @@ protected function schedule(Schedule $schedule)
3034
$schedule->command('invites:purge')
3135
->daily();
3236

33-
$schedule->command('hms:members:audit')
37+
$schedule->job(new MembershipAuditJob)
3438
->weekdays()
3539
->dailyAt('23:55');
3640

37-
$schedule->command('hms:members:youngHackerAudit')
41+
$schedule->job(new AuditYoungHackersJob)
3842
->dailyAt('06:00');
3943

4044
$schedule->command('auth:clear-resets')
@@ -44,6 +48,8 @@ protected function schedule(Schedule $schedule)
4448

4549
$schedule->job(new LogDebtJob)->daily();
4650
$schedule->job(new ZoneOccupantResetJob)->twiceDaily();
51+
$schedule->job(new MemberDebtNotificationJob)->monthlyOn(1, '7:00');
52+
$schedule->job(new EmailTeamReminderJob)->weeklyOn(2, '7:27');
4753
}
4854

4955
/**

app/Events/Banking/AuditRequest.php

-20
This file was deleted.

app/Events/Banking/TransactionsUploaded.php

-25
This file was deleted.

app/Events/Membership/YoungHackerAuditRequest.php

-20
This file was deleted.

0 commit comments

Comments
 (0)