Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/Models/BuildGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* @property int $autoremovetimeframe
* @property ?string $description
* @property int $summaryemail
* @property int $includesubprojectotal // Should this be a boolean?
* @property int $emailcommitters // Should this be a boolean?
* @property bool $includesubprojectotal
* @property bool $emailcommitters
* @property BuildGroupType $type
*
* @mixin Builder<BuildGroup>
Expand Down Expand Up @@ -57,8 +57,8 @@ class BuildGroup extends Model
'endtime' => 'datetime',
'autoremovetimeframe' => 'integer',
'summaryemail' => 'integer',
'includesubprojectotal' => 'integer',
'emailcommitters' => 'integer',
'includesubprojectotal' => 'boolean',
'emailcommitters' => 'boolean',
'type' => BuildGroupType::class,
];

Expand Down
14 changes: 7 additions & 7 deletions app/cdash/app/Model/BuildGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function __construct()
'description' => '',
'summaryemail' => 0,
'type' => BuildGroupType::DAILY,
'includesubprojectotal' => 1,
'emailcommitters' => 0,
'includesubprojectotal' => true,
'emailcommitters' => false,
]);
}

Expand Down Expand Up @@ -189,7 +189,7 @@ public function SetSummaryEmail(int $email): bool
}

/** Get/Set whether or not this group should include subproject total. */
public function GetIncludeSubProjectTotal(): int|false
public function GetIncludeSubProjectTotal(): bool
{
if (!isset($this->eloquent_model->id)) {
Log::error('BuildGroup GetIncludeSubProjectTotal(): Id not set');
Expand All @@ -200,7 +200,7 @@ public function GetIncludeSubProjectTotal(): int|false

public function SetIncludeSubProjectTotal(int $b): void
{
$this->eloquent_model->includesubprojectotal = $b > 0 ? 1 : 0;
$this->eloquent_model->includesubprojectotal = (bool) $b;
}

/**
Expand All @@ -210,11 +210,11 @@ public function SetIncludeSubProjectTotal(int $b): void
*/
public function isNotifyingCommitters(): bool
{
return (bool) $this->GetEmailCommitters();
return $this->GetEmailCommitters();
}

/** Get/Set whether or not committers should be emailed for this group. */
public function GetEmailCommitters(): int|false
public function GetEmailCommitters(): bool
{
if (!isset($this->eloquent_model->id)) {
Log::error('BuildGroup GetEmailCommitters(): Id not set');
Expand All @@ -225,7 +225,7 @@ public function GetEmailCommitters(): int|false

public function SetEmailCommitters($b): void
{
$this->eloquent_model->emailcommitters = $b ? 1 : 0;
$this->eloquent_model->emailcommitters = (bool) $b;
}

/** Get/Set the type */
Expand Down
18 changes: 9 additions & 9 deletions app/cdash/app/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function GetNumberOfWarningBuilds(string $startUTCdate, string $endUTCdat
AND build.starttime <= ?
AND build2group.buildid = build.id
AND build2group.groupid = buildgroup.id
AND buildgroup.includesubprojectotal = 1
AND buildgroup.includesubprojectotal = true
AND build.buildwarnings > 0
AND build.parentid IS NULL
', [(int) $this->Id, $startUTCdate, $endUTCdate])[0]->c;
Expand All @@ -328,7 +328,7 @@ public function GetNumberOfErrorBuilds(string $startUTCdate, string $endUTCdate)
AND build.starttime <= ?
AND build2group.buildid = build.id
AND build2group.groupid = buildgroup.id
AND buildgroup.includesubprojectotal = 1
AND buildgroup.includesubprojectotal = true
AND build.builderrors > 0
AND build.parentid IS NULL
', [(int) $this->Id, $startUTCdate, $endUTCdate])[0]->c;
Expand All @@ -350,7 +350,7 @@ public function GetNumberOfPassingBuilds(string $startUTCdate, string $endUTCdat
b.projectid=?
AND b.starttime>?
AND b.starttime<=?
AND bg.includesubprojectotal=1
AND bg.includesubprojectotal=true
AND b.builderrors=0
AND b.buildwarnings=0
AND b.parentid IS NULL
Expand All @@ -374,7 +374,7 @@ public function GetNumberOfWarningConfigures(string $startUTCdate, string $endUT
AND b.starttime > ?
AND b.starttime <= ?
AND b.configurewarnings > 0
AND bg.includesubprojectotal = 1
AND bg.includesubprojectotal = true
AND b.parentid IS NULL
', [(int) $this->Id, $startUTCdate, $endUTCdate])[0]->c;
}
Expand All @@ -396,7 +396,7 @@ public function GetNumberOfErrorConfigures(string $startUTCdate, string $endUTCd
AND b.starttime > ?
AND b.starttime <= ?
AND b.configureerrors > 0
AND bg.includesubprojectotal = 1
AND bg.includesubprojectotal = true
AND b.parentid IS NULL
', [(int) $this->Id, $startUTCdate, $endUTCdate])[0]->c;
}
Expand All @@ -419,7 +419,7 @@ public function GetNumberOfPassingConfigures(string $startUTCdate, string $endUT
AND b.starttime <= ?
AND b.configureerrors = 0
AND b.configurewarnings = 0
AND bg.includesubprojectotal = 1
AND bg.includesubprojectotal = true
AND b.parentid IS NULL
', [(int) $this->Id, $startUTCdate, $endUTCdate])[0]->c;
}
Expand All @@ -439,7 +439,7 @@ public function GetNumberOfPassingTests(string $startUTCdate, string $endUTCdate
AND build2group.buildid = build.id
AND build.testpassed >= 0
AND build2group.groupid = buildgroup.id
AND buildgroup.includesubprojectotal = 1
AND buildgroup.includesubprojectotal = true
AND build.starttime > ?
AND build.starttime <= ?
AND build.parentid IS NULL
Expand All @@ -461,7 +461,7 @@ public function GetNumberOfFailingTests(string $startUTCdate, string $endUTCdate
AND build2group.buildid = build.id
AND build.testfailed >= 0
AND build2group.groupid = buildgroup.id
AND buildgroup.includesubprojectotal = 1
AND buildgroup.includesubprojectotal = true
AND build.starttime > ?
AND build.starttime <= ?
AND build.parentid IS NULL
Expand All @@ -483,7 +483,7 @@ public function GetNumberOfNotRunTests(string $startUTCdate, string $endUTCdate)
AND build2group.buildid = build.id
AND build.testnotrun >= 0
AND build2group.groupid = buildgroup.id
AND buildgroup.includesubprojectotal = 1
AND buildgroup.includesubprojectotal = true
AND build.starttime > ?
AND build.starttime <= ?
AND build.parentid IS NULL
Expand Down
4 changes: 2 additions & 2 deletions app/cdash/app/Model/SubProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function GetLastSubmission(): string|false
subprojectid=?
AND build2group.buildid=build.id
AND build2group.groupid=buildgroup.id
AND buildgroup.includesubprojectotal=1
AND buildgroup.includesubprojectotal=true
ORDER BY build.starttime DESC
LIMIT 1
', [$this->Id]);
Expand Down Expand Up @@ -358,7 +358,7 @@ public function CommonBuildQuery($startUTCdate, $endUTCdate, bool $allSubProject
b.projectid = ? AND
b.starttime > ? AND
b.starttime <= ? AND
bg.includesubprojectotal = 1";
bg.includesubprojectotal = true";
$params = array_merge($params, [(int) $this->ProjectId, $startUTCdate, $endUTCdate]);
if ($allSubProjects) {
$query .= ' GROUP BY subprojectid';
Expand Down
4 changes: 2 additions & 2 deletions database/factories/BuildGroupFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function definition(): array
'autoremovetimeframe' => 0,
'description' => Str::uuid()->toString(),
'summaryemail' => 0,
'includesubprojectotal' => 1,
'emailcommitters' => 0,
'includesubprojectotal' => true,
'emailcommitters' => false,
'type' => 'Daily',
];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration {
public function up(): void
{
DB::statement('ALTER TABLE buildgroup ALTER COLUMN includesubprojectotal DROP DEFAULT');
DB::statement('ALTER TABLE buildgroup ALTER COLUMN includesubprojectotal TYPE boolean USING includesubprojectotal::text::boolean');
DB::statement('ALTER TABLE buildgroup ALTER COLUMN includesubprojectotal SET DEFAULT TRUE');
DB::statement('ALTER TABLE buildgroup ALTER COLUMN includesubprojectotal SET NOT NULL');

DB::statement('ALTER TABLE buildgroup ALTER COLUMN emailcommitters DROP DEFAULT');
DB::statement('ALTER TABLE buildgroup ALTER COLUMN emailcommitters TYPE boolean USING emailcommitters::text::boolean');
DB::statement('ALTER TABLE buildgroup ALTER COLUMN emailcommitters SET DEFAULT FALSE');
DB::statement('ALTER TABLE buildgroup ALTER COLUMN emailcommitters SET NOT NULL');
}

public function down(): void
{
}
};
8 changes: 2 additions & 6 deletions resources/js/angular/views/manageBuildGroup.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@
<label>
<input type="checkbox"
ng-model="buildgroup.emailcommitters"
name="emailCommitters"
ng-true-value="1"
ng-false-value="0"/>
name="emailCommitters"/>
Email committers
</label>
<p class="help-block">
Expand All @@ -127,9 +125,7 @@
<label>
<input type="checkbox"
ng-model="buildgroup.includesubprojecttotal"
name="includeInSummary"
ng-true-value="1"
ng-false-value="0"/>
name="includeInSummary"/>
Included in SubProject summary
</label>
<p class="help-block">
Expand Down