8
0

Merge pull request from Programvareverkstedet/brettspillkveld

Added brettspillkveld
This commit is contained in:
2022-09-24 22:05:21 +02:00
committed by GitHub
3 changed files with 18 additions and 13 deletions

@ -28,7 +28,8 @@ $agenda = new \pvv\side\Agenda([
// new \pvv\side\social\NerdepitsaActivity, // new \pvv\side\social\NerdepitsaActivity,
// new \pvv\side\social\AnimekveldActivity, // new \pvv\side\social\AnimekveldActivity,
new \pvv\side\social\HackekveldActivity, new \pvv\side\social\HackekveldActivity,
new \pvv\side\social\DriftkveldActivity, new \pvv\side\social\BrettspillActivity,
new \pvv\side\social\DriftkveldActivity,
new \pvv\side\DBActivity($pdo), new \pvv\side\DBActivity($pdo),
]); ]);

@ -8,20 +8,24 @@ use \DateInterval;
class BrettspillActivity implements Activity { class BrettspillActivity implements Activity {
public function nextDate(DateTimeImmutable $date) { public function nextDate(DateTimeImmutable $date) {
if ($date->format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30) if ($date->format('H') > 17 || $date->format('H') == 16 && $date->format('i') > 15)
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 30, 0)); return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(16, 15, 0));
$date = $date->setTime(19, 30, 0); $date = $date->setTime(16, 15, 0);
if ($date->format('N') != 4) if ($date->format('N') != 6)
return $this->nextDate($date->add(new DateInterval('P1D'))); return $this->nextDate($date->add(new DateInterval('P1D')));
if ($date->format('W') % 4 - 3)
return $this->nextDate($date->add(new DateInterval('P7D')));
return $date; return $date;
} }
public function prevDate(DateTimeImmutable $date) { public function prevDate(DateTimeImmutable $date) {
if ($date->format('H') < 19 || $date->format('H') == 20 && $date->format('i') < 30) if ($date->format('H') < 16 || $date->format('H') == 17 && $date->format('i') < 15)
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(19, 30, 0)); return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(16, 15, 0));
$date = $date->setTime(19, 30, 0); $date = $date->setTime(16, 15, 0);
if ($date->format('N') != 4) if ($date->format('N') != 6)
return $this->prevDate($date->sub(new DateInterval('P1D'))); return $this->prevDate($date->sub(new DateInterval('P1D')));
if ($date->format('W') % 4 - 3)
return $this->nextDate($date->add(new DateInterval('P7D')));
return $date; return $date;
} }

@ -16,11 +16,11 @@ class BrettspillEvent extends Event {
} }
public function getLocation() /* : Location */ { public function getLocation() /* : Location */ {
return "Koserommet"; return "Programvareverkstedet";
} }
public function getOrganiser() /* : User */ { public function getOrganiser() /* : User */ {
return "Robert Maikher"; return "Programvareverkstedet";
} }
public function getURL() /* : string */ { public function getURL() /* : string */ {
@ -33,8 +33,8 @@ class BrettspillEvent extends Event {
public function getDescription() { public function getDescription() {
return [ return [
'Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo?'. 'Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo? '.
'Da er vår brettspillkveld noe for deg!' . 'Da er vår brettspillkveld noe for deg! ' .
'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!', 'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!',
'', '',
'## Vår samling', '## Vår samling',