Add Verhaltenskodex prevention
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ca0dd11336
commit
306fef3e07
|
@ -355,6 +355,10 @@ class Member extends Model implements Geolocatable
|
||||||
$preventions[] = Prevention::EFZ;
|
$preventions[] = Prevention::EFZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->has_vk) {
|
||||||
|
$preventions[] = Prevention::VK;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->more_ps_at === null) {
|
if ($this->more_ps_at === null) {
|
||||||
if ($this->ps_at === null || $this->ps_at->diffInYears($date) >= 5) {
|
if ($this->ps_at === null || $this->ps_at->diffInYears($date) >= 5) {
|
||||||
$preventions[] = Prevention::PS;
|
$preventions[] = Prevention::PS;
|
||||||
|
|
|
@ -7,6 +7,7 @@ enum Prevention
|
||||||
case EFZ;
|
case EFZ;
|
||||||
case PS;
|
case PS;
|
||||||
case MOREPS;
|
case MOREPS;
|
||||||
|
case VK;
|
||||||
|
|
||||||
public function text(): string
|
public function text(): string
|
||||||
{
|
{
|
||||||
|
@ -14,6 +15,7 @@ enum Prevention
|
||||||
static::EFZ => 'erweitertes Führungszeugnis',
|
static::EFZ => 'erweitertes Führungszeugnis',
|
||||||
static::PS => 'Präventionsschulung Basis Plus',
|
static::PS => 'Präventionsschulung Basis Plus',
|
||||||
static::MOREPS => 'Präventionsschulung (Auffrischung)',
|
static::MOREPS => 'Präventionsschulung (Auffrischung)',
|
||||||
|
static::VK => 'Verhaltenskodex',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,44 +111,49 @@ class PreventionTest extends TestCase
|
||||||
protected function attributes(): Generator
|
protected function attributes(): Generator
|
||||||
{
|
{
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => null, 'ps_at' => now()],
|
'attrs' => ['has_vk' => true, 'efz' => null, 'ps_at' => now()],
|
||||||
'preventions' => [Prevention::EFZ]
|
'preventions' => [Prevention::EFZ]
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now(), 'ps_at' => null],
|
'attrs' => ['has_vk' => true, 'efz' => now(), 'ps_at' => null],
|
||||||
'preventions' => [Prevention::PS]
|
'preventions' => [Prevention::PS]
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now()->subDay(), 'ps_at' => now()],
|
'attrs' => ['has_vk' => true, 'efz' => now()->subDay(), 'ps_at' => now()],
|
||||||
'preventions' => []
|
'preventions' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now(), 'ps_at' => now()->subDay()],
|
'attrs' => ['has_vk' => true, 'efz' => now(), 'ps_at' => now()->subDay()],
|
||||||
'preventions' => []
|
'preventions' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now()->subYears(5)->subDay(), 'ps_at' => now()],
|
'attrs' => ['has_vk' => true, 'efz' => now()->subYears(5)->subDay(), 'ps_at' => now()],
|
||||||
'preventions' => [Prevention::EFZ]
|
'preventions' => [Prevention::EFZ]
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now(), 'ps_at' => now()->subYears(5)->subDay()],
|
'attrs' => ['has_vk' => true, 'efz' => now(), 'ps_at' => now()->subYears(5)->subDay()],
|
||||||
'preventions' => [Prevention::PS]
|
'preventions' => [Prevention::PS]
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now(), 'ps_at' => now()->subYears(5)->subDay(), 'more_ps_at' => now()],
|
'attrs' => ['has_vk' => true, 'efz' => now(), 'ps_at' => now()->subYears(5)->subDay(), 'more_ps_at' => now()],
|
||||||
'preventions' => []
|
'preventions' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['efz' => now(), 'ps_at' => now()->subYears(15), 'more_ps_at' => now()->subYears(5)->subDay()],
|
'attrs' => ['has_vk' => true, 'efz' => now(), 'ps_at' => now()->subYears(15), 'more_ps_at' => now()->subYears(5)->subDay()],
|
||||||
'preventions' => [Prevention::MOREPS],
|
'preventions' => [Prevention::MOREPS],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
yield [
|
||||||
|
'attrs' => ['has_vk' => false, 'efz' => now(), 'ps_at' => now()],
|
||||||
|
'preventions' => [Prevention::VK],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue