Add brettspill, drift and hack activities

This commit is contained in:
Felix Albrigtsen 2023-01-16 14:18:30 +01:00
parent 3a39ca0f73
commit a734fe6bd3
4 changed files with 10 additions and 11 deletions

View File

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

View File

@ -11,9 +11,9 @@ class BrettspillActivity implements Activity {
if ($date->format('H') > 17 || $date->format('H') == 16 && $date->format('i') > 15)
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(16, 15, 0));
$date = $date->setTime(16, 15, 0);
if ($date->format('N') != 6)
if ($date->format('N') != 7)
return $this->nextDate($date->add(new DateInterval('P1D')));
if ($date->format('W') % 4 - 3)
if ($date->format('W') % 2 - 1)
return $this->nextDate($date->add(new DateInterval('P7D')));
return $date;
}
@ -22,10 +22,9 @@ class BrettspillActivity implements Activity {
if ($date->format('H') < 16 || $date->format('H') == 17 && $date->format('i') < 15)
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(16, 15, 0));
$date = $date->setTime(16, 15, 0);
if ($date->format('N') != 6)
if ($date->format('N') != 7)
return $this->prevDate($date->sub(new DateInterval('P1D')));
if ($date->format('W') % 4 - 3)
return $this->nextDate($date->add(new DateInterval('P7D')));
return $date;
}

View File

@ -13,7 +13,7 @@ class DriftkveldActivity implements Activity {
$date = $date->setTime(18, 15, 0);
if ($date->format('N') != 6)
return $this->nextDate($date->add(new DateInterval('P1D')));
if ($date->format('W') % 2)
if ($date->format('W') % 2 - 1)
return $this->nextDate($date->add(new DateInterval('P7D')));
return $date;
}
@ -24,7 +24,7 @@ class DriftkveldActivity implements Activity {
$date = $date->setTime(18, 15, 0);
if ($date->format('N') != 6)
return $this->prevDate($date->sub(new DateInterval('P1D')));
if ($date->format('W') % 2)
if ($date->format('W') % 2 - 1)
return $this->prevDate($date->sub(new DateInterval('P7D')));
return $date;
}

View File

@ -13,7 +13,7 @@ class HackekveldActivity implements Activity {
$date = $date->setTime(16, 15, 0);
if ($date->format('N') != 6)
return $this->nextDate($date->add(new DateInterval('P1D')));
if ($date->format('W') % 4 - 1)
if ($date->format('W') % 2)
return $this->nextDate($date->add(new DateInterval('P7D')));
return $date;
}
@ -24,7 +24,7 @@ class HackekveldActivity implements Activity {
$date = $date->setTime(18, 15, 0);
if ($date->format('N') != 6)
return $this->prevDate($date->sub(new DateInterval('P1D')));
if ($date->format('W') % 4 - 1)
if ($date->format('W') % 2)
return $this->prevDate($date->sub(new DateInterval('P7D')));
return $date;
}