0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-04-02 12:37:56 +00:00

hide not started projects in widget

This commit is contained in:
Kevin Papst 2021-10-03 13:38:08 +02:00
parent 4bb9edb2b5
commit e8cb5b0581
2 changed files with 9 additions and 0 deletions
src/Entity
tests/Entity

View file

@ -474,6 +474,9 @@ class Project implements EntityWithMetaFields, EntityWithBudget
if ($this->getCustomer() !== null && !$this->getCustomer()->isVisible()) {
return false;
}
if ($this->getStart() !== null && $dateTime < $this->getStart()) {
return false;
}
if ($this->getEnd() !== null && $dateTime > $this->getEnd()) {
return false;
}

View file

@ -247,5 +247,11 @@ class ProjectTest extends AbstractEntityTest
self::assertTrue($sut->isVisibleAtDate($now));
$sut->setEnd(new \DateTime('-1 hour'));
self::assertFalse($sut->isVisibleAtDate($now));
$sut->setEnd(new \DateTime('+1 hour'));
self::assertTrue($sut->isVisibleAtDate($now));
$sut->setStart(new \DateTime('-1 hour'));
self::assertTrue($sut->isVisibleAtDate($now));
$sut->setStart(new \DateTime('+1 hour'));
self::assertFalse($sut->isVisibleAtDate($now));
}
}