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
5 changes: 4 additions & 1 deletion app/Http/Controllers/CoverageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ public function manageCoverage(): View|RedirectResponse
// Send an email
if (isset($_POST['sendEmail'])) {
$coverageThreshold = $Project->GetCoverageThreshold();
$userids = $CoverageFile2User->GetUsersFromProject();
$userids = DB::table('coveragefilepriority')
->join('coveragefile2user', 'coveragefilepriority.id', '=', 'coveragefile2user.fileid')
->where('coveragefilepriority.projectid', '=', intval($projectid))->distinct()
->pluck('userid')->toArray();
foreach ($userids as $userid) {
$CoverageFile2User->UserId = $userid;
$fileids = $CoverageFile2User->GetFiles();
Expand Down
31 changes: 1 addition & 30 deletions app/cdash/app/Model/CoverageFile2User.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

namespace CDash\Model;

use CDash\Database;
Expand Down Expand Up @@ -286,36 +287,6 @@ public function GetCoverageFileId($buildid): int|false
return intval($query_result['id']);
}

/**
* Get the list of authors for the project
*
* @return array<int>|false
*/
public function GetUsersFromProject(): array|false
{
if (!isset($this->ProjectId) || $this->ProjectId < 1) {
abort(500, 'CoverageFile2User:GetUsersFromProject: projectid not valid');
}

$db = Database::getInstance();
$query_result = $db->executePrepared('
SELECT DISTINCT userid
FROM coveragefile2user, coveragefilepriority
WHERE
coveragefilepriority.id=coveragefile2user.fileid
AND coveragefilepriority.projectid=?
', [intval($this->ProjectId)]);
if (empty($query_result)) {
add_last_sql_error('CoverageFile2User:GetUsersFromProject');
return false;
}
$userids = [];
foreach ($query_result as $query_array) {
$userids[] = intval($query_array['userid']);
}
return $userids;
}

/** Assign the last author */
public function AssignLastAuthor(int $buildid): bool
{
Expand Down
6 changes: 3 additions & 3 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6550,7 +6550,7 @@ parameters:
#^Call to deprecated function add_last_sql_error\\(\\)\\:
04/22/2023$#
"""
count: 13
count: 12
path: app/cdash/app/Model/CoverageFile2User.php

-
Expand All @@ -6566,7 +6566,7 @@ parameters:
#^Call to deprecated method executePrepared\\(\\) of class CDash\\\\Database\\:
04/22/2023 Use Laravel query builder or Eloquent instead$#
"""
count: 11
count: 10
path: app/cdash/app/Model/CoverageFile2User.php

-
Expand All @@ -6579,7 +6579,7 @@ parameters:

-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 5
count: 4
path: app/cdash/app/Model/CoverageFile2User.php

-
Expand Down