diff --git a/app/Models/BuildGroup.php b/app/Models/BuildGroup.php index 1a96b17320..9c4e7074ef 100644 --- a/app/Models/BuildGroup.php +++ b/app/Models/BuildGroup.php @@ -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 @@ -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, ]; diff --git a/app/cdash/app/Model/BuildGroup.php b/app/cdash/app/Model/BuildGroup.php index 712626c647..3663fd226e 100644 --- a/app/cdash/app/Model/BuildGroup.php +++ b/app/cdash/app/Model/BuildGroup.php @@ -45,8 +45,8 @@ public function __construct() 'description' => '', 'summaryemail' => 0, 'type' => BuildGroupType::DAILY, - 'includesubprojectotal' => 1, - 'emailcommitters' => 0, + 'includesubprojectotal' => true, + 'emailcommitters' => false, ]); } @@ -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'); @@ -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; } /** @@ -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'); @@ -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 */ diff --git a/app/cdash/app/Model/Project.php b/app/cdash/app/Model/Project.php index b7d686660c..35aedd9061 100644 --- a/app/cdash/app/Model/Project.php +++ b/app/cdash/app/Model/Project.php @@ -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; @@ -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; @@ -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 @@ -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; } @@ -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; } @@ -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; } @@ -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 @@ -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 @@ -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 diff --git a/app/cdash/app/Model/SubProject.php b/app/cdash/app/Model/SubProject.php index d47cc80264..f2a769f258 100644 --- a/app/cdash/app/Model/SubProject.php +++ b/app/cdash/app/Model/SubProject.php @@ -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]); @@ -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'; diff --git a/database/factories/BuildGroupFactory.php b/database/factories/BuildGroupFactory.php index 0f5342eba1..e1a45f921d 100644 --- a/database/factories/BuildGroupFactory.php +++ b/database/factories/BuildGroupFactory.php @@ -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', ]; } diff --git a/database/migrations/2026_09_14_133940_buildgroup_boolean_columns.php b/database/migrations/2026_09_14_133940_buildgroup_boolean_columns.php new file mode 100644 index 0000000000..467848520b --- /dev/null +++ b/database/migrations/2026_09_14_133940_buildgroup_boolean_columns.php @@ -0,0 +1,23 @@ + + name="emailCommitters"/> Email committers

@@ -127,9 +125,7 @@