From be86db36e9f0c3e1b2a49fcb69fda418d26b189a Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Mon, 20 Apr 2020 20:07:04 +0800 Subject: [PATCH 1/4] Courses.php: fix typo Successfull. --- Courses.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Courses.php b/Courses.php index 88d7ad3..4314a3a 100644 --- a/Courses.php +++ b/Courses.php @@ -139,7 +139,7 @@ New Date/Time
query($sql) === TRUE) { - $_SESSION["info_Updated"]="Information Updated Successfull"; + $_SESSION["info_Updated"]="Assignment information updated successfully."; } else { echo "Error: " . $sql . "
" . $con->error; From 18f2e7023aabf0aa203e8ba6f923143e845bc32d Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Mon, 20 Apr 2020 20:11:40 +0800 Subject: [PATCH 2/4] Courses.php: change info_Updated to info_updated. PHP usually uses camelCase as its naming convention. In that case, there should be no underscore between info and Updated. --- Courses.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Courses.php b/Courses.php index 4314a3a..ed7c864 100644 --- a/Courses.php +++ b/Courses.php @@ -139,7 +139,7 @@ New Date/Time
query($sql) === TRUE) { - $_SESSION["info_Updated"]="Assignment information updated successfully."; + $_SESSION["info_updated"]="Assignment information updated successfully."; } else { echo "Error: " . $sql . "
" . $con->error; @@ -253,9 +253,9 @@ Submission Type echo "

Lab Report Assignment list

"; error_reporting(0); - if(isset($_SESSION["info_Updated"])){ - echo '
'; - $_SESSION['info_Updated'] = null; + if(isset($_SESSION["info_updated"])){ + echo '
'; + $_SESSION['info_updated'] = null; } if (isset($_SESSION['info_courses'])) { echo '
'; From b7d6ae1bcf48a6ba23148d39388f8a851fe2a537 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Tue, 21 Apr 2020 20:48:13 +0800 Subject: [PATCH 3/4] Script.php: [bugfix] fix -- "Students unable to submit assignment after a recent change" This commit temporarily fixed the bug reported at http://118.25.96.118/bugzilla/show_bug.cgi?id=65 This bug was introduced after a recent functionality addition, i.e., allowing Lecturer to edit assignment information. See the following pull request for details. https://github.com/lanlab-org/LRR/pull/21 It seems that $group_id is not properly assigned after merging the above pull request. Therefore, when someone tried to insert a record to the database table lab_report_submissions, he encountered a running error. In this fix, I just set $group_id 0 to avoid the database insertion error. This is OK when an assignment is of type Individual. Of course, this fix is not ideal, as it cannot handle the situation where the assignment is of type Group. In the future, $group_id must be properly initialized, depending on the assignment type. -Hui --- Script.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Script.php b/Script.php index 5adff14..65ca093 100644 --- a/Script.php +++ b/Script.php @@ -827,7 +827,13 @@ if(strlen($_FILES['attachment1']['name']) > 2 ) { if ($con->query($sql1) === TRUE) { } - + + // When $group_id is not properly initialized, use integer 0 as its value. + // This temporarily fixed the "Students unable to submit assignment after a recent change" bug at http://118.25.96.118/bugzilla/show_bug.cgi?id=65 + if (trim($group_id) === '') { + $group_id = 0; // FIXME + } + $sql="INSERT INTO `lab_report_submissions`(`Submission_Date`, `Lab_Report_ID`, `Student_id`," . " `Course_Group_id`, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Status`, `Title`,`Remarking_Reason`)" . " VALUES ('$date',$lab_id,$student_id,$group_id,'$targetfile','$instructions','$targetfile2','$targetfile3','$targetfile4'," From a89b8f4e0d81c9eb5cbb4a178c8b840a53aabf6a Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Thu, 23 Apr 2020 10:10:58 +0800 Subject: [PATCH 4/4] Script.php: why use the function trim? --- Script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Script.php b/Script.php index 65ca093..a09609c 100644 --- a/Script.php +++ b/Script.php @@ -830,7 +830,7 @@ if(strlen($_FILES['attachment1']['name']) > 2 ) { // When $group_id is not properly initialized, use integer 0 as its value. // This temporarily fixed the "Students unable to submit assignment after a recent change" bug at http://118.25.96.118/bugzilla/show_bug.cgi?id=65 - if (trim($group_id) === '') { + if (trim($group_id) === '') { // when $group_id is an empty string or contains only whitespace characters. $group_id = 0; // FIXME }