Skip to content

Commit

Permalink
Remove CASE from queryLogs call
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPoppe committed Aug 17, 2021
1 parent 5e7e102 commit 6369d1c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/classes/ParticipantHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,15 @@ public function expirePasswordResetToken($rcpro_participant_id)
*/
public function getAllParticipants()
{
$SQL = "SELECT log_id, rcpro_username, email, fname, lname, lockout_ts, (CASE WHEN (pw IS NULL OR pw = '') THEN 'False' ELSE 'True' END) AS pw_set WHERE message = 'PARTICIPANT' AND (project_id IS NULL OR project_id IS NOT NULL)";
$SQL = "SELECT log_id, rcpro_username, email, fname, lname, lockout_ts, pw WHERE message = 'PARTICIPANT' AND (project_id IS NULL OR project_id IS NOT NULL)";
try {
$result = self::$module->queryLogs($SQL, []);
$participants = array();

// grab participant details
while ($row = $result->fetch_assoc()) {
$row["pw_set"] = (!isset($row["pw"]) || $row["pw"] === "") ? "False" : "True";
unset($row["pw"]);
$participants[$row["log_id"]] = $row;
}
return $participants;
Expand Down Expand Up @@ -378,9 +380,11 @@ public function getProjectParticipants(string $rcpro_project_id, ?int $dag = NUL
$participants = array();

while ($row = $result->fetch_assoc()) {
$participantSQL = "SELECT log_id, rcpro_username, email, fname, lname, lockout_ts, (CASE WHEN (pw IS NULL OR pw = '') THEN 'False' ELSE 'True' END) AS pw_set WHERE message = 'PARTICIPANT' AND log_id = ? AND (project_id IS NULL OR project_id IS NOT NULL)";
$participantSQL = "SELECT log_id, rcpro_username, email, fname, lname, lockout_ts, pw WHERE message = 'PARTICIPANT' AND log_id = ? AND (project_id IS NULL OR project_id IS NOT NULL)";
$participantResult = self::$module->queryLogs($participantSQL, [$row["rcpro_participant_id"]]);
$participant = $participantResult->fetch_assoc();
$participant["pw_set"] = (!isset($participant["pw"]) || $participant["pw"] === "") ? "False" : "True";
unset($participant["pw"]);
$participants[$row["rcpro_participant_id"]] = $participant;
}
return $participants;
Expand Down

0 comments on commit 6369d1c

Please sign in to comment.