From 68fe54a848b2ca00ee6a964fb528ce6733944bcb Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Thu, 13 Aug 2020 21:28:24 +0100 Subject: [PATCH 1/4] :bug: Fix get open subs error Signed-off-by: Luke Tainton --- app/includes/app_functions.php | 39 +++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/app/includes/app_functions.php b/app/includes/app_functions.php index 5e2e050..e6f306f 100644 --- a/app/includes/app_functions.php +++ b/app/includes/app_functions.php @@ -68,23 +68,28 @@ } function get_open_subscribed_requests($db) { - $requests = array(); - $sub_tickets_stmt = "SELECT ticket_uuid FROM ticket_subscribers WHERE user_uuid=:uuid"; - $sub_tickets_sql = $db->prepare($sub_tickets_stmt); - $sub_tickets_sql->bindParam(':uuid', $_SESSION['uuid']); - $sub_tickets_sql->execute(); - $sub_tickets_sql->setFetchMode(PDO::FETCH_ASSOC); - $sub_tickets_result = $sub_tickets_sql->fetchAll(); - foreach ($sub_tickets_result as $tkt) { - $stmt = "SELECT * FROM tickets WHERE uuid=:uuid AND status != 'Closed'"; - $sql = $db->prepare($stmt); - $sql->bindParam(':uuid', $tkt['ticket_uuid']); - $sql->execute(); - $sql->setFetchMode(PDO::FETCH_ASSOC); - $result = $sql->fetchAll(); - array_push($requests, $result[0]); - } - return $requests; + $subbed_reqs_arr = array(); + $requests = array(); + $sub_tickets_stmt = "SELECT ticket_uuid FROM ticket_subscribers WHERE user_uuid=:uuid"; + $sub_tickets_sql = $db->prepare($sub_tickets_stmt); + $sub_tickets_sql->bindParam(':uuid', $_SESSION['uuid']); + $sub_tickets_sql->execute(); + $sub_tickets_sql->setFetchMode(PDO::FETCH_ASSOC); + $sub_tickets_result = $sub_tickets_sql->fetchAll(); + foreach ($sub_tickets_result as $tkt) { + array_push($subbed_reqs_arr, $tkt['ticket_uuid']); + } + $subbed_reqs = implode(",", $subbed_reqs_arr); + $stmt = "SELECT * FROM tickets WHERE uuid IN :uuid"; + $sql = $db->prepare($stmt); + $sql->bindParam(':uuid', $subbed_reqs); + $sql->execute(); + $sql->setFetchMode(PDO::FETCH_ASSOC); + $result = $sql->fetchAll(); + foreach ($result as $sub) { + array_push($requests, $sub) + } + return $requests; } function get_request($db, $uuid) { From c9c9e2f8319a238888b4b692e10fbfd889cb0c13 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Thu, 13 Aug 2020 21:31:26 +0100 Subject: [PATCH 2/4] :bug: Forgot a semicolon Signed-off-by: Luke Tainton --- app/includes/app_functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/includes/app_functions.php b/app/includes/app_functions.php index e6f306f..b973d49 100644 --- a/app/includes/app_functions.php +++ b/app/includes/app_functions.php @@ -87,7 +87,7 @@ $sql->setFetchMode(PDO::FETCH_ASSOC); $result = $sql->fetchAll(); foreach ($result as $sub) { - array_push($requests, $sub) + array_push($requests, $sub); } return $requests; } From 675ab129080d49e3fe5e28e4b071af4eea763070 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Thu, 13 Aug 2020 21:42:05 +0100 Subject: [PATCH 3/4] :art: Fix get subbed requests functions Signed-off-by: Luke Tainton --- app/includes/app_functions.php | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/app/includes/app_functions.php b/app/includes/app_functions.php index b973d49..6b24d39 100644 --- a/app/includes/app_functions.php +++ b/app/includes/app_functions.php @@ -68,26 +68,23 @@ } function get_open_subscribed_requests($db) { - $subbed_reqs_arr = array(); $requests = array(); - $sub_tickets_stmt = "SELECT ticket_uuid FROM ticket_subscribers WHERE user_uuid=:uuid"; - $sub_tickets_sql = $db->prepare($sub_tickets_stmt); - $sub_tickets_sql->bindParam(':uuid', $_SESSION['uuid']); - $sub_tickets_sql->execute(); - $sub_tickets_sql->setFetchMode(PDO::FETCH_ASSOC); - $sub_tickets_result = $sub_tickets_sql->fetchAll(); - foreach ($sub_tickets_result as $tkt) { - array_push($subbed_reqs_arr, $tkt['ticket_uuid']); + $all_subs = get_subscribed_requests($db); + foreach ($all_subs as $sub) { + if ($sub['status'] != 'Closed') { + array_push($requests, $sub); + } } - $subbed_reqs = implode(",", $subbed_reqs_arr); - $stmt = "SELECT * FROM tickets WHERE uuid IN :uuid"; - $sql = $db->prepare($stmt); - $sql->bindParam(':uuid', $subbed_reqs); - $sql->execute(); - $sql->setFetchMode(PDO::FETCH_ASSOC); - $result = $sql->fetchAll(); - foreach ($result as $sub) { - array_push($requests, $sub); + return $requests; + } + + function get_closed_subscribed_requests($db) { + $requests = array(); + $all_subs = get_subscribed_requests($db); + foreach ($all_subs as $sub) { + if ($sub['status'] == 'Closed') { + array_push($requests, $sub); + } } return $requests; } From ab1d1f0d3533f82abbae696b42d271d32ba6df93 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Thu, 13 Aug 2020 21:55:49 +0100 Subject: [PATCH 4/4] :green_heart: Remove broken automation Signed-off-by: Luke Tainton --- .github/workflows/assigned-issues-inprogress.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/workflows/assigned-issues-inprogress.yml diff --git a/.github/workflows/assigned-issues-inprogress.yml b/.github/workflows/assigned-issues-inprogress.yml deleted file mode 100644 index 67de8d7..0000000 --- a/.github/workflows/assigned-issues-inprogress.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Run project automation tasks - -on: - issues: - types: [assigned] - -jobs: - issues-inprogress: - runs-on: ubuntu-latest - steps: - - uses: alex-page/github-project-automation-plus@v0.2.4 - with: - project: v1.0 - column: In progress - repo-token: ${{ secrets.GITHUB_TOKEN }}