From 9655a1cbb53f821d9a13d48326fea51058c391e8 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Thu, 4 Feb 2021 10:13:09 +0530 Subject: [PATCH 01/42] Update Security_user.php --- app/Models/Security_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Security_user.php b/app/Models/Security_user.php index f540ad37..b591cc24 100755 --- a/app/Models/Security_user.php +++ b/app/Models/Security_user.php @@ -206,7 +206,7 @@ public function insertExaminationStudent($student) return $studentData; } catch (\Exception $th) { Log::error($th->getMessage()); - // in case of duplication of the Unique ID this will recursive. + // in case of duplication of the Unique ID this will recursive till success. $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); $this->insertExaminationStudent($sis_student); } From 0bb3156f6c2412600cac1f91caef2dee003d03e4 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Tue, 9 Feb 2021 09:04:21 +0530 Subject: [PATCH 02/42] fix empty data retrival --- app/Http/Controllers/ExaminationStudentsController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 2a094e1c..e3c547f3 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -191,8 +191,8 @@ public function doMatch($offset, $limit, $mode) $this->output->writeln('All are generated'); break; case 'empty'; - $students = Examination_student::whereNull('nsid') - ->orWhere('nsid', '<>', '') + $students = Examination_student:: + whereNull('nsid') ->where('grade', $this->grade) ->where('year', $this->year) ->offset($offset) @@ -440,7 +440,6 @@ public function updateStudentId($student, $sis_student) unset($student['st_no']); $this->output->writeln('Updated to NSID' . $sis_student['openemis_no']); } catch (\Exception $th) { - dd($th); $this->output->writeln('error'); Log::error($th); } From dcced2bf50c688290bb51790231bc3e4a681b390 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Wed, 17 Feb 2021 15:45:31 +0530 Subject: [PATCH 03/42] add git option for nsid gen --- app/Http/Controllers/ExaminationStudentsController.php | 7 ++++++- app/Models/Institution_student.php | 2 ++ app/Models/Security_user.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index e3c547f3..47b254f3 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -192,7 +192,7 @@ public function doMatch($offset, $limit, $mode) break; case 'empty'; $students = Examination_student:: - whereNull('nsid') + whereNull('nsid') ->where('grade', $this->grade) ->where('year', $this->year) ->offset($offset) @@ -246,6 +246,7 @@ public function setIsTakingExam($students) $students['taking_g5_exam'] = false; $students['taking_ol_exam'] = false; $students['taking_al_exam'] = false; + $students['taking_git_exam'] = false; switch ($this->education_grade->code) { case 'G5': $students['taking_g5_exam'] = true; @@ -259,6 +260,9 @@ public function setIsTakingExam($students) case 'G11': $students['taking_ol_exam'] = true; break; + case 'GIT': + $students['taking_git_exam'] = true; + break; // case preg_match('13', $this->education_grade->code): // $students['taking_al_exam'] = true; // break; @@ -434,6 +438,7 @@ public function updateStudentId($student, $sis_student) unset($student['taking_g5_exam']); unset($student['taking_al_exam']); unset($student['taking_ol_exam']); + unset($student['taking_git_exam']); unset($student['total']); $students['updated_at'] = now(); $this->examination_student->where('st_no', $student['st_no'])->update($student); diff --git a/app/Models/Institution_student.php b/app/Models/Institution_student.php index 44c80bbb..7a05738b 100755 --- a/app/Models/Institution_student.php +++ b/app/Models/Institution_student.php @@ -153,10 +153,12 @@ public static function createExaminationData($student, $admissionInfo) 'taking_g5_exam' => $student['taking_g5_exam'], 'taking_ol_exam' => $student['taking_ol_exam'], 'taking_al_exam' => $student['taking_al_exam'], + 'taking_git_exam' => $student['taking_git_exam'], // Set special examination center 'exam_center_for_special_education_g5' => $student['taking_g5_exam'] ? $student['sp_center'] : 0, 'exam_center_for_special_education_ol' => $student['taking_ol_exam'] ? $student['sp_center'] : 0, 'exam_center_for_special_education_al' => $student['taking_al_exam'] ? $student['sp_center'] : 0, + 'exam_center_for_special_education_git' => $student['taking_git_exam'] ? $student['sp_center'] : 0, 'income_at_g5' => $student['a_income'], 'education_grade_id' => $admissionInfo['education_grade']->id, 'academic_period_id' => $admissionInfo['academic_period']->id, diff --git a/app/Models/Security_user.php b/app/Models/Security_user.php index f540ad37..9b30a6d6 100755 --- a/app/Models/Security_user.php +++ b/app/Models/Security_user.php @@ -247,7 +247,7 @@ public function updateExaminationStudent($student, $sis_student) Log::error($th); // in case of duplication of the Unique ID this will recursive. $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); - $this->updateExaminationStudent($student, $sis_student); + $this->updateExaminationStudent($student,$sis_student); } } From 3711edeaf3f5eff3b1738479e74d4423a0304133 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Wed, 17 Feb 2021 15:46:28 +0530 Subject: [PATCH 04/42] add git fields --- .../2021_02_17_101132_add_g_i_t_fields.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 database/migrations/2021_02_17_101132_add_g_i_t_fields.php diff --git a/database/migrations/2021_02_17_101132_add_g_i_t_fields.php b/database/migrations/2021_02_17_101132_add_g_i_t_fields.php new file mode 100644 index 00000000..240b51da --- /dev/null +++ b/database/migrations/2021_02_17_101132_add_g_i_t_fields.php @@ -0,0 +1,34 @@ +boolean('taking_git_exam')->default(false); + $table->boolean('exam_center_for_special_education_git')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('institution_students', function (Blueprint $table) { + $table->dropColumn('taking_git_exam'); + $table->dropColumn('exam_center_for_special_education_git'); + }); + } +} From e86be14d9d4b5b666623f3d2495e10611f641140 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Wed, 17 Feb 2021 15:46:28 +0530 Subject: [PATCH 05/42] squash! add git option for nsid gen add git fields --- .../2021_02_17_101132_add_g_i_t_fields.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 database/migrations/2021_02_17_101132_add_g_i_t_fields.php diff --git a/database/migrations/2021_02_17_101132_add_g_i_t_fields.php b/database/migrations/2021_02_17_101132_add_g_i_t_fields.php new file mode 100644 index 00000000..240b51da --- /dev/null +++ b/database/migrations/2021_02_17_101132_add_g_i_t_fields.php @@ -0,0 +1,34 @@ +boolean('taking_git_exam')->default(false); + $table->boolean('exam_center_for_special_education_git')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('institution_students', function (Blueprint $table) { + $table->dropColumn('taking_git_exam'); + $table->dropColumn('exam_center_for_special_education_git'); + }); + } +} From d0a4f0f0b7536200f930903d2de6be19c03c47c8 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Wed, 3 Mar 2021 14:13:12 +0530 Subject: [PATCH 06/42] Fix NSID gen for GIT --- .../ExaminationStudentsController.php | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 47b254f3..34dd3caa 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -247,26 +247,24 @@ public function setIsTakingExam($students) $students['taking_ol_exam'] = false; $students['taking_al_exam'] = false; $students['taking_git_exam'] = false; - switch ($this->education_grade->code) { - case 'G5': - $students['taking_g5_exam'] = true; - break; - case 'G4': - $students['taking_g5_exam'] = true; - break; - case 'G10': - $students['taking_ol_exam'] = true; - break; - case 'G11': - $students['taking_ol_exam'] = true; - break; - case 'GIT': - $students['taking_git_exam'] = true; - break; - // case preg_match('13', $this->education_grade->code): - // $students['taking_al_exam'] = true; - // break; - } + switch ($students['grade']) { + case 'G5': + $students['taking_g5_exam'] = true; + break; + case 'G4': + $students['taking_g5_exam'] = true; + break; + case 'G10': + $students['taking_ol_exam'] = true; + break; + case 'G11': + $students['taking_ol_exam'] = true; + break; + case 'GIT': + $students['taking_git_exam'] = true; + break; + } + return $students; } @@ -293,11 +291,14 @@ public function clone($student) $institutionClass = Institution_class::where( [ 'institution_id' => $institution->id, - 'academic_period_id' => $this->academic_period->id, - 'education_grade_id' => $this->education_grade->id + 'academic_period_id' => $this->academic_period->id ] - )->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id')->get()->toArray(); + ) + ->where( 'education_grade_id','in', [$this->student->education_garde_id]) + ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id')->get()->toArray(); + $this->education_grade = Education_grade::where('id', '=', $this->student->education_garde_id)->first(); + // set search variables $admissionInfo = [ 'instituion_class' => $institutionClass, @@ -312,18 +313,18 @@ public function clone($student) //TODO implement insert student to admission table $student['id'] = $sis_student['id']; - $sis_student['student_id'] = $student['id']; - + $sis_student['student_id'] = $student['id' ]; $student = $this->setIsTakingExam($student); - if (count($institutionClass) == 1) { + if (count($institutionClass) == 1) { $admissionInfo['instituion_class'] = $institutionClass[0]; - Institution_student::createExaminationData($student, $admissionInfo); + Institution_student::createExaminationData($student, $admissionInfo); Institution_student_admission::createExaminationData($student, $admissionInfo); Institution_class_student::createExaminationData($student, $admissionInfo); } else { - Institution_student_admission::createExaminationData($student, $admissionInfo); + Institution_student_admission::createExaminationData($student, $admissionInfo); Institution_student::createExaminationData($student, $admissionInfo); } + $this->updateStudentId($student, $sis_student); // update the matched student's data } else { From ef779ca9b248c38a8b4f62e24333fd4fa340bde2 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Thu, 18 Mar 2021 13:03:03 +0530 Subject: [PATCH 07/42] fix git class import issue --- .../Controllers/ExaminationStudentsController.php | 11 ++++++++--- app/Imports/ExaminationStudentsImport.php | 5 ++++- app/Models/Security_user.php | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 34dd3caa..289ddb2f 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -297,7 +297,12 @@ public function clone($student) ->where( 'education_grade_id','in', [$this->student->education_garde_id]) ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id')->get()->toArray(); - $this->education_grade = Education_grade::where('id', '=', $this->student->education_garde_id)->first(); + + if(!is_null($this->student->education_garde_id)){ + $this->education_grade = Education_grade::where('id', '=', $this->student->education_garde_id)->first(); + }else{ + $this->student->education_garde_id = $this->education_grade->id; + } // set search variables $admissionInfo = [ @@ -314,6 +319,7 @@ public function clone($student) //TODO implement insert student to admission table $student['id'] = $sis_student['id']; $sis_student['student_id'] = $student['id' ]; + $student = $this->setIsTakingExam($student); if (count($institutionClass) == 1) { $admissionInfo['instituion_class'] = $institutionClass[0]; @@ -464,7 +470,6 @@ public function export() (new ExportReady($adminUser)); } catch (\Throwable $th) { //throw $th; - dd($th); } return back()->withSuccess('Export started!'); } @@ -478,7 +483,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052465.csv'; return Response::download($file_path); } } diff --git a/app/Imports/ExaminationStudentsImport.php b/app/Imports/ExaminationStudentsImport.php index d75784c7..e97d3ccf 100644 --- a/app/Imports/ExaminationStudentsImport.php +++ b/app/Imports/ExaminationStudentsImport.php @@ -83,7 +83,7 @@ private function transformDateTime(string $value, string $format = 'm/d/Y') */ public function model(array $row) { - + try { $insertData = array( 'st_no' => $row['st_no'], 'stu_no' => $row['stu_no'], @@ -102,6 +102,9 @@ public function model(array $row) "sp_center" => $row['sp_center'] ); Examination_student::insertData($insertData); + } catch (\Throwable $th) { + // dd($row); + } } public function rules(): array diff --git a/app/Models/Security_user.php b/app/Models/Security_user.php index 9b30a6d6..954bb846 100755 --- a/app/Models/Security_user.php +++ b/app/Models/Security_user.php @@ -207,8 +207,8 @@ public function insertExaminationStudent($student) } catch (\Exception $th) { Log::error($th->getMessage()); // in case of duplication of the Unique ID this will recursive. - $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); - $this->insertExaminationStudent($sis_student); + $student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); + $this->insertExaminationStudent($student); } return $studentData; } From b710a60508ba15e208cfc036cc3278d1f3f39b0c Mon Sep 17 00:00:00 2001 From: Kosala Gangabadage Date: Tue, 4 May 2021 23:55:48 +0530 Subject: [PATCH 08/42] Platformer GitHub Action Created --- ...r-b02b6ae4-58bf-45b1-97ea-60d7d937e37e.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/platformer-b02b6ae4-58bf-45b1-97ea-60d7d937e37e.yml diff --git a/.github/workflows/platformer-b02b6ae4-58bf-45b1-97ea-60d7d937e37e.yml b/.github/workflows/platformer-b02b6ae4-58bf-45b1-97ea-60d7d937e37e.yml new file mode 100644 index 00000000..80fabb93 --- /dev/null +++ b/.github/workflows/platformer-b02b6ae4-58bf-45b1-97ea-60d7d937e37e.yml @@ -0,0 +1,36 @@ +name: Platformer Generated bulk-upload-uat-workflow Build +'on': + push: + branches: + - UAT +jobs: + build: + runs-on: + - ubuntu-latest + env: + SERVICE_NAME: docker.pkg.github.com/moe-lk/bulk-upload/bulk-upload + CONTAINER_REGISTRY: docker.pkg.github.com + steps: + - uses: actions/checkout@v2 + - name: Set Version + id: event-version + run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/heads/}-${{github.sha}} + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.CONTAINER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.DOCKER_PASSWORD_B02B6AE4_58BF_45B1_97EA_60D7D937E37E }} + - name: Build the Docker image + run: docker build --tag ${SERVICE_NAME}:${{steps.event-version.outputs.SOURCE_TAG }} --file Dockerfile . + - name: GitHub Image Push + run: docker push $SERVICE_NAME:${{steps.event-version.outputs.SOURCE_TAG }} + - name: Platformer Deploy + uses: platformer-com/build-deploy-action@v1 + with: + org-id: ${{secrets.ORG_ID_767EF5C0_2F2A_4CAE_A434_126B65702226}} + project-id: ${{secrets.PROJECT_ID_767EF5C0_2F2A_4CAE_A434_126B65702226}} + token: ${{secrets.AUTOGENERATED_CICD_767EF5C0_2F2A_4CAE_A434_126B65702226}} + image-name: ${{env.SERVICE_NAME}} + tag: ${{steps.event-version.outputs.SOURCE_TAG }} + container-id: f8781cf8-cddc-4150-bed7-b3839b29b423 From b07dcd6b93c7f89ab55827ead968b206d0f551d9 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Tue, 18 May 2021 11:20:22 +0530 Subject: [PATCH 09/42] Update Dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7b7a4de5..08d21376 100755 --- a/Dockerfile +++ b/Dockerfile @@ -64,5 +64,7 @@ RUN chgrp -R www-data storage/ && \ RUN composer install +RUN sudo groupadd docker +RUN sudo usermod -aG docker devuser -EXPOSE 80 \ No newline at end of file +EXPOSE 80 From e28895121e7cde59cf34f5b2f471e6b80f3ac3ca Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Thu, 20 May 2021 09:03:08 +0530 Subject: [PATCH 10/42] Update Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 08d21376..b40d94c7 100755 --- a/Dockerfile +++ b/Dockerfile @@ -67,4 +67,7 @@ RUN composer install RUN sudo groupadd docker RUN sudo usermod -aG docker devuser +RUN chmod -R 775 storage +RUN chmod -R 775 bootstrap/cache + EXPOSE 80 From bc807c95e307916dbb570b24215791e0377de48a Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Fri, 21 May 2021 08:43:32 +0530 Subject: [PATCH 11/42] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b40d94c7..3debaa85 100755 --- a/Dockerfile +++ b/Dockerfile @@ -67,7 +67,7 @@ RUN composer install RUN sudo groupadd docker RUN sudo usermod -aG docker devuser -RUN chmod -R 775 storage -RUN chmod -R 775 bootstrap/cache +RUN sudo chown -R devuser:www-data storage +RUN sudo chown -R devuser:www-data bootstrap/cache EXPOSE 80 From 2367a50ff424d075ddd9aa06f592c6a1e00d7aee Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Fri, 21 May 2021 08:53:02 +0530 Subject: [PATCH 12/42] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3debaa85..5639a428 100755 --- a/Dockerfile +++ b/Dockerfile @@ -65,9 +65,9 @@ RUN chgrp -R www-data storage/ && \ RUN composer install RUN sudo groupadd docker -RUN sudo usermod -aG docker devuser +RUN sudo usermod -aG docker $user -RUN sudo chown -R devuser:www-data storage -RUN sudo chown -R devuser:www-data bootstrap/cache +RUN sudo chown -R $user:www-data storage +RUN sudo chown -R $user:www-data bootstrap/cache EXPOSE 80 From 3d156035b3b0723ed45644a80063ae24decc12e7 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Sat, 22 May 2021 08:27:23 +0530 Subject: [PATCH 13/42] Update classTeacher.php --- app/Http/Middleware/classTeacher.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Middleware/classTeacher.php b/app/Http/Middleware/classTeacher.php index 199b24ed..95a8d488 100755 --- a/app/Http/Middleware/classTeacher.php +++ b/app/Http/Middleware/classTeacher.php @@ -16,6 +16,7 @@ class classTeacher public function handle($request, Closure $next) { if($request->user()->super_admin == 1){ + dd($request); return $next($request); }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { return $next($request); From 4fe6f856e4ec99b5d82284b92dd41aeccb9161c2 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Sat, 22 May 2021 08:28:16 +0530 Subject: [PATCH 14/42] Update classTeacher.php --- app/Http/Middleware/classTeacher.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Http/Middleware/classTeacher.php b/app/Http/Middleware/classTeacher.php index 95a8d488..199b24ed 100755 --- a/app/Http/Middleware/classTeacher.php +++ b/app/Http/Middleware/classTeacher.php @@ -16,7 +16,6 @@ class classTeacher public function handle($request, Closure $next) { if($request->user()->super_admin == 1){ - dd($request); return $next($request); }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { return $next($request); From 5df20ab20b1da33fb28a524bb600f58d2a4f6962 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 24 May 2021 09:48:51 +0530 Subject: [PATCH 15/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index ce33aac0..6a8b0eb0 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052465.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052475.csv'; return Response::download($file_path); } } From ba3f0440ad39105f5724509e9406d053b5c5cce3 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 24 May 2021 09:49:42 +0530 Subject: [PATCH 16/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 6a8b0eb0..2666cd4b 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052475.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; return Response::download($file_path); } } From a46e5a1fee5336ab7b794019be794e523d0f46d0 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 24 May 2021 09:55:37 +0530 Subject: [PATCH 17/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 2666cd4b..499aa470 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1621567983.csv'; return Response::download($file_path); } } From a188c843fa02996251d6c94543fe3260b4d828f2 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 24 May 2021 09:56:54 +0530 Subject: [PATCH 18/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 499aa470..ce33aac0 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1621567983.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052465.csv'; return Response::download($file_path); } } From b1e3dd953705ba336050812926b4eb441bcc8b3d Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 24 May 2021 09:59:03 +0530 Subject: [PATCH 19/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index ce33aac0..499aa470 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052465.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1621567983.csv'; return Response::download($file_path); } } From 22456146bdecc3eba82ad2acd1db2be42057e713 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 24 May 2021 10:00:25 +0530 Subject: [PATCH 20/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 499aa470..ce33aac0 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1621567983.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052465.csv'; return Response::download($file_path); } } From a3e1166d87b816a0a6b557ae164d7f8a67c8c603 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Wed, 16 Jun 2021 16:34:51 +0530 Subject: [PATCH 21/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index ce33aac0..7767a407 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1616052465.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1623836541.csv'; return Response::download($file_path); } } From 5d3350c54ac8afe6f0d54fe65f51cce6e5f3d3df Mon Sep 17 00:00:00 2001 From: Kosala Gangabadage Date: Tue, 29 Jun 2021 10:40:55 +0530 Subject: [PATCH 22/42] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5639a428..755ce467 100755 --- a/Dockerfile +++ b/Dockerfile @@ -65,7 +65,7 @@ RUN chgrp -R www-data storage/ && \ RUN composer install RUN sudo groupadd docker -RUN sudo usermod -aG docker $user +RUN sudo usermod -aG docker devuser RUN sudo chown -R $user:www-data storage RUN sudo chown -R $user:www-data bootstrap/cache From a399f121bfcc1bb7cc8104dceed3463895ecf488 Mon Sep 17 00:00:00 2001 From: Kosala Gangabadage Date: Tue, 29 Jun 2021 11:57:49 +0530 Subject: [PATCH 23/42] Platformer GitHub Action Created --- ...r-f113ee6d-983b-476b-8fc0-72817120e519.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/platformer-f113ee6d-983b-476b-8fc0-72817120e519.yml diff --git a/.github/workflows/platformer-f113ee6d-983b-476b-8fc0-72817120e519.yml b/.github/workflows/platformer-f113ee6d-983b-476b-8fc0-72817120e519.yml new file mode 100644 index 00000000..10c721dd --- /dev/null +++ b/.github/workflows/platformer-f113ee6d-983b-476b-8fc0-72817120e519.yml @@ -0,0 +1,36 @@ +name: Platformer Generated bulk-upload-uat-workflow Build +'on': + push: + branches: + - UAT +jobs: + build: + runs-on: + - ubuntu-latest + env: + SERVICE_NAME: docker.pkg.github.com/moe-lk/bulk-upload/bulk-upload + CONTAINER_REGISTRY: docker.pkg.github.com + steps: + - uses: actions/checkout@v2 + - name: Set Version + id: event-version + run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/heads/}-${{github.sha}} + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.CONTAINER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.DOCKER_PASSWORD_F113EE6D_983B_476B_8FC0_72817120E519 }} + - name: Build the Docker image + run: docker build --tag ${SERVICE_NAME}:${{steps.event-version.outputs.SOURCE_TAG }} --file Dockerfile . + - name: GitHub Image Push + run: docker push $SERVICE_NAME:${{steps.event-version.outputs.SOURCE_TAG }} + - name: Platformer Deploy + uses: platformer-com/build-deploy-action@v1 + with: + org-id: ${{secrets.ORG_ID_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + project-id: ${{secrets.PROJECT_ID_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + token: ${{secrets.AUTOGENERATED_CICD_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + image-name: ${{env.SERVICE_NAME}} + tag: ${{steps.event-version.outputs.SOURCE_TAG }} + container-id: 92937b4e-a44d-4e36-8867-487a822dfbbf From 3ed745acd4ffe5374ddf5699d82ff020069da077 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Fri, 2 Jul 2021 12:10:59 +0530 Subject: [PATCH 24/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 7767a407..4611c811 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1623836541.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1625206576.csv'; return Response::download($file_path); } } From bce6fe5ca1a433c4133547e862277767a7470aa0 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Fri, 2 Jul 2021 14:25:48 +0530 Subject: [PATCH 25/42] Create RunAddStudentsToInstitutions --- .../Commands/RunAddStudentsToInstitutions.php | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 app/Console/Commands/RunAddStudentsToInstitutions.php diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php new file mode 100644 index 00000000..538637fd --- /dev/null +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -0,0 +1,121 @@ + $this->argument('institution') + ])->first(); + + if(!is_null($institution)){ + + // dd($institution); + try { + $this->info('adding missing students to the institution ' . $institution->name); + $approvedstudent = Institution_student_admission::select('institution_student_admission.*')->join('institutions', 'institution_id', '=', 'institutions.id')->leftJoin('institution_students', 'student_id', '=', 'institution_students.student_id')->where([ + // 'status_id' => 121,122,123,124, // + 'institution_id' => $institution->id + ])->get()->toArray(); + dd($approvedstudent); + $approvedstudent = array_chunk($approvedstudent, 50); + array_walk($approvedstudent, array($this, 'addStudents')); + }catch (\Exception $e) { + Log::error($e); + } + + } + } + + protected function addStudents($approvedstudent){ + array_walk($approvedstudent,array($this,'addStudent')); + } + + protected function addStudent($approvedstudent){ + $output = new \Symfony\Component\Console\Output\ConsoleOutput(); + Log::info($approvedstudent); + + sleep(1); + if(!(Institution_student::isDuplicated($approvedstudent) > 0)){ + $this->count += 1; + $this->student = $approvedstudent ; + try{ + Institution_student::insert([ + 'student_status_id' => 1, + 'student_id' => $approvedstudent['student_id'], + 'education_grade_id' => $approvedstudent['education_grade_id'], + 'academic_period_id' => $approvedstudent['academic_period_id'], + 'start_date' => $approvedstudent['start_date'], + 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), + 'end_date' => $approvedstudent['end_date'], + 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), + 'institution_id' => $approvedstudent['institution_id'], + 'admission_id' => $approvedstudent['admission_id'], + 'created_user_id' => $approvedstudent['created_user_id'], + ]); + + if(!is_null($approvedstudent['institution_class_id'])){ + Institution_class_student::insert([ + 'student_id' => $approvedstudent['student_id'], + 'institution_class_id' => $approvedstudent['institution_class_id'], + 'education_grade_id' => $approvedstudent['education_grade_id'], + 'academic_period_id' => $approvedstudent['academic_period_id'], + 'institution_id' =>$approvedstudent['institution_id'], + 'student_status_id' => 1, + 'created_user_id' => $approvedstudent['created_user_id'], + ]); + } + $output->writeln(' + #################################################### + Total number of students updated : '.$this->count.' + # # + ####################################################' ); +// $output->writeln(); + }catch (\Exception $e){ +// echo $e->getMessage(); + $output->writeln( $e->getMessage()); + } + } + + } +} From 2916985cf4fef43882812d6187cb46c12dfe8ece Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 5 Jul 2021 14:51:59 +0530 Subject: [PATCH 26/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 4611c811..410238a9 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1625206576.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1625461120.csv'; return Response::download($file_path); } } From 1f048f0e9d990ee42328b0f303c2c8424cf34113 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 5 Jul 2021 16:22:14 +0530 Subject: [PATCH 27/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 410238a9..83759dcd 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -485,7 +485,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1625461120.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1625482133.csv'; return Response::download($file_path); } } From 306d70b2ccd4335c04a0d3add18b39c1a8135eae Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Thu, 8 Jul 2021 14:47:26 +0530 Subject: [PATCH 28/42] Update RunAddStudentsToInstitions.php --- .../Commands/RunAddStudentsToInstitutions.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index 538637fd..4c656d1e 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -8,6 +8,7 @@ use App\Models\Institution_student_admission; use App\Models\Institution_student; use App\Models\Institution; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; class RunAddStudentsToInstitutions extends Command @@ -53,11 +54,12 @@ public function handle() // dd($institution); try { $this->info('adding missing students to the institution ' . $institution->name); - $approvedstudent = Institution_student_admission::select('institution_student_admission.*')->join('institutions', 'institution_id', '=', 'institutions.id')->leftJoin('institution_students', 'student_id', '=', 'institution_students.student_id')->where([ - // 'status_id' => 121,122,123,124, // - 'institution_id' => $institution->id - ])->get()->toArray(); - dd($approvedstudent); + $approvedstudent = DB::table('institution_student_admission')->select('*') + ->join('institutions', 'institution_id', '=', 'institutions.id') + ->leftJoin('institution_students', 'student_id', '=', 'institution_students.student_id') + ->whereIn('status_id',[121,122,123,124]) + ->where('institution_id',$institution->id)->get()->toArray(); + // dd($approvedstudent); $approvedstudent = array_chunk($approvedstudent, 50); array_walk($approvedstudent, array($this, 'addStudents')); }catch (\Exception $e) { From b60ebfae53a84b14d33edef7289d770adfbcfe40 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Thu, 8 Jul 2021 15:11:51 +0530 Subject: [PATCH 29/42] update RunAddStudentsToInstitutions.php --- app/Console/Commands/RunAddStudentsToInstitutions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index 4c656d1e..82562dc7 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -44,6 +44,7 @@ public function __construct() */ public function handle() { + DB::enableQueryLog(); // dd('test'); $institution = Institution::where([ 'id' => $this->argument('institution') @@ -52,15 +53,17 @@ public function handle() if(!is_null($institution)){ // dd($institution); + try { $this->info('adding missing students to the institution ' . $institution->name); $approvedstudent = DB::table('institution_student_admission')->select('*') ->join('institutions', 'institution_id', '=', 'institutions.id') ->leftJoin('institution_students', 'student_id', '=', 'institution_students.student_id') ->whereIn('status_id',[121,122,123,124]) - ->where('institution_id',$institution->id)->get()->toArray(); - // dd($approvedstudent); + ->where('institutions.id',$institution->id)->get()->toArray(); + dd(DB::getQueryLog()); $approvedstudent = array_chunk($approvedstudent, 50); + // dd($approvedstudent); array_walk($approvedstudent, array($this, 'addStudents')); }catch (\Exception $e) { Log::error($e); From 27915829feafba66bfa8508f0aee764eb24cde59 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Thu, 22 Jul 2021 14:18:24 +0530 Subject: [PATCH 30/42] added console commands --- .../RollbackStudentFromInstitutes.php | 86 +++++++++++++++++++ .../Commands/RunAddStudentsToInstitutions.php | 39 +++++---- 2 files changed, 107 insertions(+), 18 deletions(-) create mode 100644 app/Console/Commands/RollbackStudentFromInstitutes.php diff --git a/app/Console/Commands/RollbackStudentFromInstitutes.php b/app/Console/Commands/RollbackStudentFromInstitutes.php new file mode 100644 index 00000000..7a0a5cd4 --- /dev/null +++ b/app/Console/Commands/RollbackStudentFromInstitutes.php @@ -0,0 +1,86 @@ +info('Fetching all the records...'); + $institution_grades = DB::select('select * from institution_grades where institution_id = :id', ['id' => $this->argument('institution')]); + + /* + * First check whether the array is not empty + * Then loop though all the records and check the promoted value + * If the promoted value is equal to 2019 keep it as it is otherwise set it back to 2019 + */ + if (!empty($institution_grades)) { + + $this->info('Fetched ' . count($institution_grades) . ' records'); + + foreach ($institution_grades as $institute_grade) { + if ($institute_grade->promoted == "2019") { + $this->info('Promoted year have already set to 2019'); + } else { + $this->info('Updating record ======================================='); + DB::update("update institution_grades set promoted ='2019' where institution_id = ?", [$this->argument('institution')]); + $this->info('Record updated ========================================'); + } + } + } else { + $this->info('No results!'); + } + } catch (\Exception $e) { + return $e->getMessage(); + } + } +} diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index 82562dc7..d778df76 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -44,48 +44,51 @@ public function __construct() */ public function handle() { - DB::enableQueryLog(); + // dd('test'); $institution = Institution::where([ 'id' => $this->argument('institution') ])->first(); + // dd($institution); if(!is_null($institution)){ - - // dd($institution); - + DB::enableQueryLog(); + // dd($institution->id); try { $this->info('adding missing students to the institution ' . $institution->name); - $approvedstudent = DB::table('institution_student_admission')->select('*') - ->join('institutions', 'institution_id', '=', 'institutions.id') - ->leftJoin('institution_students', 'student_id', '=', 'institution_students.student_id') + $approvedstudent = Institution_student_admission::select('*') + // ->join('institutions', 'institution_id', '=', 'institutions.id') + ->leftJoin('institution_students', 'institution_student_admission.student_id', '=', 'institution_students.student_id') ->whereIn('status_id',[121,122,123,124]) - ->where('institutions.id',$institution->id)->get()->toArray(); - dd(DB::getQueryLog()); - $approvedstudent = array_chunk($approvedstudent, 50); - // dd($approvedstudent); - array_walk($approvedstudent, array($this, 'addStudents')); + ->where('institution_student_admission.institution_id',$institution->id)->get()->toArray(); + // dd(DB::getQueryLog()); + // $approvedstudent = array_chunk($approvedstudent, 50); + // dd($approvedstudent['student_id']); + dd(array_walk($approvedstudent, array($this, 'addStudents'))); + }catch (\Exception $e) { Log::error($e); - } - + } } } protected function addStudents($approvedstudent){ - array_walk($approvedstudent,array($this,'addStudent')); + array_walk($approvedstudent,array($this,'addStudent')); + // dd($approvedstudent); } protected function addStudent($approvedstudent){ + $output = new \Symfony\Component\Console\Output\ConsoleOutput(); Log::info($approvedstudent); sleep(1); if(!(Institution_student::isDuplicated($approvedstudent) > 0)){ + // dd($approvedstudent); $this->count += 1; $this->student = $approvedstudent ; try{ - Institution_student::insert([ + $inserted = Institution_student::insert([ 'student_status_id' => 1, 'student_id' => $approvedstudent['student_id'], 'education_grade_id' => $approvedstudent['education_grade_id'], @@ -97,8 +100,8 @@ protected function addStudent($approvedstudent){ 'institution_id' => $approvedstudent['institution_id'], 'admission_id' => $approvedstudent['admission_id'], 'created_user_id' => $approvedstudent['created_user_id'], - ]); - + ])->toSql(); + dd($inserted); if(!is_null($approvedstudent['institution_class_id'])){ Institution_class_student::insert([ 'student_id' => $approvedstudent['student_id'], From b875a928fc931dee55920c5abc47a2ff1ab55f81 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 26 Jul 2021 10:57:21 +0530 Subject: [PATCH 31/42] Update RunAddStudentsToInstitutions --- .../Commands/RunAddStudentsToInstitutions.php | 43 ++++++++----------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index d778df76..ef1a674e 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -34,6 +34,7 @@ class RunAddStudentsToInstitutions extends Command */ public function __construct() { + $this->count = 0; parent::__construct(); } @@ -45,26 +46,22 @@ public function __construct() public function handle() { - // dd('test'); $institution = Institution::where([ 'id' => $this->argument('institution') ])->first(); - // dd($institution); if(!is_null($institution)){ DB::enableQueryLog(); - // dd($institution->id); try { $this->info('adding missing students to the institution ' . $institution->name); - $approvedstudent = Institution_student_admission::select('*') - // ->join('institutions', 'institution_id', '=', 'institutions.id') + $approvedstudent = Institution_student_admission::select('institution_student_admission.*') ->leftJoin('institution_students', 'institution_student_admission.student_id', '=', 'institution_students.student_id') ->whereIn('status_id',[121,122,123,124]) ->where('institution_student_admission.institution_id',$institution->id)->get()->toArray(); - // dd(DB::getQueryLog()); - // $approvedstudent = array_chunk($approvedstudent, 50); - // dd($approvedstudent['student_id']); - dd(array_walk($approvedstudent, array($this, 'addStudents'))); + + $approvedstudent = array_chunk($approvedstudent, 50); + + array_walk($approvedstudent, array($this, 'addStudents')); }catch (\Exception $e) { Log::error($e); @@ -74,21 +71,19 @@ public function handle() protected function addStudents($approvedstudent){ array_walk($approvedstudent,array($this,'addStudent')); - // dd($approvedstudent); } protected function addStudent($approvedstudent){ - $output = new \Symfony\Component\Console\Output\ConsoleOutput(); Log::info($approvedstudent); - sleep(1); - if(!(Institution_student::isDuplicated($approvedstudent) > 0)){ - // dd($approvedstudent); + if((Institution_student::isDuplicated($approvedstudent) == 0)){ + dd($approvedstudent); $this->count += 1; $this->student = $approvedstudent ; try{ - $inserted = Institution_student::insert([ + $output->writeln($approvedstudent['student_id']."Updated"); + Institution_student::create([ 'student_status_id' => 1, 'student_id' => $approvedstudent['student_id'], 'education_grade_id' => $approvedstudent['education_grade_id'], @@ -100,10 +95,9 @@ protected function addStudent($approvedstudent){ 'institution_id' => $approvedstudent['institution_id'], 'admission_id' => $approvedstudent['admission_id'], 'created_user_id' => $approvedstudent['created_user_id'], - ])->toSql(); - dd($inserted); + ]); if(!is_null($approvedstudent['institution_class_id'])){ - Institution_class_student::insert([ + Institution_class_student::create([ 'student_id' => $approvedstudent['student_id'], 'institution_class_id' => $approvedstudent['institution_class_id'], 'education_grade_id' => $approvedstudent['education_grade_id'], @@ -113,17 +107,14 @@ protected function addStudent($approvedstudent){ 'created_user_id' => $approvedstudent['created_user_id'], ]); } - $output->writeln(' + }catch (\Exception $e){ + echo $e->getMessage(); + } + } + $output->writeln(' #################################################### Total number of students updated : '.$this->count.' # # ####################################################' ); -// $output->writeln(); - }catch (\Exception $e){ -// echo $e->getMessage(); - $output->writeln( $e->getMessage()); - } - } - } } From bf3bcea543220d47d9d7a83f030c4c8b6a5169ec Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 26 Jul 2021 17:04:44 +0530 Subject: [PATCH 32/42] Update RunAddStudentsToInstitutions.php --- app/Console/Commands/RunAddStudentsToInstitutions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index ef1a674e..029e04e9 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -76,7 +76,7 @@ protected function addStudents($approvedstudent){ protected function addStudent($approvedstudent){ $output = new \Symfony\Component\Console\Output\ConsoleOutput(); Log::info($approvedstudent); - sleep(1); +// sleep(1); if((Institution_student::isDuplicated($approvedstudent) == 0)){ dd($approvedstudent); $this->count += 1; From f473d02fde83a6b3e281115190919f2cf74dfa72 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Mon, 9 Aug 2021 14:34:16 +0530 Subject: [PATCH 33/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index c388a460..a5e4e96c 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -486,7 +486,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1625482133.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv'; return Response::download($file_path); } } From 8121b8a5d94f1a857bb547b6e814a65d851cc921 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Sat, 4 Sep 2021 12:24:51 +0530 Subject: [PATCH 34/42] Update RunAddStudentsToInstitutions.php --- app/Console/Commands/RunAddStudentsToInstitutions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index 029e04e9..ea9fb0b4 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -118,3 +118,4 @@ protected function addStudent($approvedstudent){ ####################################################' ); } } +$output->writeln('operation Complete'); From d6d15fa2dbc33bbf90166e92630852ca923489f1 Mon Sep 17 00:00:00 2001 From: Kosala Gangabadage Date: Fri, 10 Dec 2021 21:07:05 +0530 Subject: [PATCH 35/42] Platformer GitHub Action Created --- ...r-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml diff --git a/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml b/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml new file mode 100644 index 00000000..412da816 --- /dev/null +++ b/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml @@ -0,0 +1,36 @@ +name: Platformer Generated bulk-upload-uat-tag Build +'on': + push: + tags: + - v* +jobs: + build: + runs-on: + - ubuntu-latest + env: + SERVICE_NAME: docker.pkg.github.com/moe-lk/bulk-upload/bulk-upload + CONTAINER_REGISTRY: docker.pkg.github.com + steps: + - uses: actions/checkout@v2 + - name: Set Version + id: event-version + run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.CONTAINER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.DOCKER_PASSWORD_83326795_7A09_4CC2_B7CB_8F5B4AE33674 }} + - name: Build the Docker image + run: docker build --tag ${SERVICE_NAME}:${{steps.event-version.outputs.SOURCE_TAG }} --file Dockerfile . + - name: GitHub Image Push + run: docker push $SERVICE_NAME:${{steps.event-version.outputs.SOURCE_TAG }} + - name: Platformer Deploy + uses: platformer-com/build-deploy-action@v1 + with: + org-id: ${{secrets.ORG_ID_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + project-id: ${{secrets.PROJECT_ID_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + token: ${{secrets.AUTOGENERATED_CICD_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + image-name: ${{env.SERVICE_NAME}} + tag: ${{steps.event-version.outputs.SOURCE_TAG }} + container-id: 33d05e0d-7144-421d-afc3-f01813f9ff7e From 0f91bcb23d10560a00fccd4f9ca3df443b33a1f6 Mon Sep 17 00:00:00 2001 From: Kosala Gangabadage Date: Fri, 10 Dec 2021 21:24:45 +0530 Subject: [PATCH 36/42] Update platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml --- .../platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml b/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml index 412da816..9d09aa49 100644 --- a/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml +++ b/.github/workflows/platformer-83326795-7a09-4cc2-b7cb-8f5b4ae33674.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - name: Set Version id: event-version - run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + run: echo ::set-output name=SOURCE_TAG::${{github.sha}} - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: From ffc845239f49d381ec5a1ace6fee39854bbc9ef0 Mon Sep 17 00:00:00 2001 From: Kosala Gangabadage Date: Fri, 10 Dec 2021 21:29:08 +0530 Subject: [PATCH 37/42] Platformer GitHub Action Created --- ...r-5f026685-2d56-4c11-9a6c-4cbb754773c2.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/platformer-5f026685-2d56-4c11-9a6c-4cbb754773c2.yml diff --git a/.github/workflows/platformer-5f026685-2d56-4c11-9a6c-4cbb754773c2.yml b/.github/workflows/platformer-5f026685-2d56-4c11-9a6c-4cbb754773c2.yml new file mode 100644 index 00000000..414366b3 --- /dev/null +++ b/.github/workflows/platformer-5f026685-2d56-4c11-9a6c-4cbb754773c2.yml @@ -0,0 +1,36 @@ +name: Platformer Generated bulk-upload-uat-tag Build +'on': + push: + tags: + - v* +jobs: + build: + runs-on: + - ubuntu-latest + env: + SERVICE_NAME: docker.pkg.github.com/moe-lk/bulk-upload/bulk-upload + CONTAINER_REGISTRY: docker.pkg.github.com + steps: + - uses: actions/checkout@v2 + - name: Set Version + id: event-version + run: echo ::set-output name=SOURCE_TAG::${{github.sha}} + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.CONTAINER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.DOCKER_PASSWORD_5F026685_2D56_4C11_9A6C_4CBB754773C2 }} + - name: Build the Docker image + run: docker build --tag ${SERVICE_NAME}:${{steps.event-version.outputs.SOURCE_TAG }} --file Dockerfile . + - name: GitHub Image Push + run: docker push $SERVICE_NAME:${{steps.event-version.outputs.SOURCE_TAG }} + - name: Platformer Deploy + uses: platformer-com/build-deploy-action@v1 + with: + org-id: ${{secrets.ORG_ID_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + project-id: ${{secrets.PROJECT_ID_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + token: ${{secrets.AUTOGENERATED_CICD_38BBBF6B_404D_4E3A_8C90_5AB3EE4DDF96}} + image-name: ${{env.SERVICE_NAME}} + tag: ${{steps.event-version.outputs.SOURCE_TAG }} + container-id: 33d05e0d-7144-421d-afc3-f01813f9ff7e From 150a7cd4881f6dc96f3271617a35bd50b284691b Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Fri, 10 Dec 2021 21:40:22 +0530 Subject: [PATCH 38/42] Update RunAddStudentsToInstitutions.php --- app/Console/Commands/RunAddStudentsToInstitutions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index ea9fb0b4..b02f1c44 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -117,5 +117,6 @@ protected function addStudent($approvedstudent){ # # ####################################################' ); } + $output->writeln('operation Complete'); } -$output->writeln('operation Complete'); + From 5cbf38e68010bf54ea0874afb1aa2a2e4e5ac5a1 Mon Sep 17 00:00:00 2001 From: Mohamed Nizar Date: Fri, 10 Dec 2021 22:12:14 +0530 Subject: [PATCH 39/42] Update RunAddStudentsToInstitutions.php --- app/Console/Commands/RunAddStudentsToInstitutions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Console/Commands/RunAddStudentsToInstitutions.php b/app/Console/Commands/RunAddStudentsToInstitutions.php index b02f1c44..997ed0f6 100644 --- a/app/Console/Commands/RunAddStudentsToInstitutions.php +++ b/app/Console/Commands/RunAddStudentsToInstitutions.php @@ -117,6 +117,5 @@ protected function addStudent($approvedstudent){ # # ####################################################' ); } - $output->writeln('operation Complete'); } From ae14ea4949ee7c1bb8f423961cbb63fe8751e13f Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Wed, 2 Mar 2022 15:21:42 +0530 Subject: [PATCH 40/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index a5e4e96c..7cb95cf1 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -486,7 +486,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv';// hard coded file name return Response::download($file_path); } } From 2bb99a2e7f889b76d90c1b004c433299ecbcda72 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Thu, 3 Mar 2022 14:02:14 +0530 Subject: [PATCH 41/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index 7cb95cf1..a5e4e96c 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -486,7 +486,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv';// hard coded file name + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv'; return Response::download($file_path); } } From 916ea01bbdbf82423995c062365ba052db97b9e6 Mon Sep 17 00:00:00 2001 From: HarindaVithana Date: Wed, 9 Mar 2022 15:28:41 +0530 Subject: [PATCH 42/42] Update ExaminationStudentsController.php --- app/Http/Controllers/ExaminationStudentsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ExaminationStudentsController.php b/app/Http/Controllers/ExaminationStudentsController.php index a5e4e96c..9eb9ca92 100644 --- a/app/Http/Controllers/ExaminationStudentsController.php +++ b/app/Http/Controllers/ExaminationStudentsController.php @@ -486,7 +486,7 @@ public function downloadErrors() public function downloadProcessedFile() { - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv'; + $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv'; //hard coded file name return Response::download($file_path); } }