fixed calendar for empty timesheet descriptions (#265)

This commit is contained in:
Kevin Papst
2018-08-10 08:19:30 +02:00
committed by GitHub
parent c6e99b35d5
commit fb2d898e4c
3 changed files with 18 additions and 4 deletions

View File

@@ -155,7 +155,7 @@ class TimesheetEntity
/** /**
* @return string * @return string
*/ */
public function getDescription(): string public function getDescription(): ?string
{ {
return $this->description; return $this->description;
} }

View File

@@ -66,10 +66,18 @@ class TimesheetFixtures extends Fixture implements DependentFixtureInterface
if ($i > self::MAX_TIMESHEETS_TOTAL) { if ($i > self::MAX_TIMESHEETS_TOTAL) {
break; break;
} }
$description = null;
if ($i % 3 == 0) {
$description = $faker->text;
} elseif ($i % 7 == 0) {
$description = '';
}
$entry = $this->createTimesheetEntry( $entry = $this->createTimesheetEntry(
$user, $user,
$activities[array_rand($activities)], $activities[array_rand($activities)],
($i % 3 == 0 ? $faker->text : ''), $description,
round($i / 2), round($i / 2),
true true
); );
@@ -89,7 +97,7 @@ class TimesheetFixtures extends Fixture implements DependentFixtureInterface
$entry = $this->createTimesheetEntry( $entry = $this->createTimesheetEntry(
$user, $user,
$activities[array_rand($activities)], $activities[array_rand($activities)],
$faker->text null
); );
$manager->persist($entry); $manager->persist($entry);
} }

View File

@@ -97,10 +97,16 @@ class TimesheetFixtures extends Fixture
$user = $this->user; $user = $this->user;
for ($i = 0; $i < $this->amount; $i++) { for ($i = 0; $i < $this->amount; $i++) {
$description = null;
if ($i % 3 == 0) {
$description = $faker->text;
} elseif ($i % 2 == 0) {
$description = '';
}
$entry = $this->createTimesheetEntry( $entry = $this->createTimesheetEntry(
$user, $user,
$activities[array_rand($activities)], $activities[array_rand($activities)],
($i % 3 == 0 ? $faker->text : ''), $description,
$this->getDateTime($i) $this->getDateTime($i)
); );