|
@@ -0,0 +1,38 @@
|
|
1
|
+<?php
|
|
2
|
+
|
|
3
|
+use Illuminate\Database\Schema\Blueprint;
|
|
4
|
+use Illuminate\Database\Migrations\Migration;
|
|
5
|
+
|
|
6
|
+class StudentCriteriaAchievedView extends Migration {
|
|
7
|
+
|
|
8
|
+ /**
|
|
9
|
+ * Run the migrations.
|
|
10
|
+ *
|
|
11
|
+ * @return void
|
|
12
|
+ */
|
|
13
|
+ public function up()
|
|
14
|
+ {
|
|
15
|
+ //
|
|
16
|
+ DB::statement(' CREATE VIEW `student_criteria_achieved`
|
|
17
|
+AS SELECT
|
|
18
|
+ `a`.`student_id` AS `student_id`,
|
|
19
|
+ `c`.`semester_id` AS `semester_id`,
|
|
20
|
+ `coo`.`criterion_id` AS `criterion_id`,
|
|
21
|
+ `coo`.`outcome_id` AS `outcome_id`,count(0) AS `total_achieved`
|
|
22
|
+FROM ((((((((`assessments` `a` join `activity_criterion` `acn`) join `activities` `ac`) join `courses` `c`) join `students` `s`) join `criterion_objective_outcome` `coo`) join `rubric_activity` `ra`) join `rubrics` `r`) join `semesters` `sm`) where ((`r`.`id` = `ra`.`rubric_id`) and (`ra`.`activity_id` = `ac`.`id`) and (`a`.`activity_criterion_id` = `acn`.`id`) and (`acn`.`activity_id` = `ac`.`id`) and (`ac`.`course_id` = `c`.`id`) and (`a`.`student_id` = `s`.`id`) and (`acn`.`criterion_id` = `coo`.`criterion_id`) and (`a`.`score` >= `r`.`expected_points`) and (`sm`.`id` = `c`.`semester_id`) and (`sm`.`is_visible` = 1)) group by `a`.`student_id`,`c`.`semester_id`,`coo`.`criterion_id`,`coo`.`outcome_id`;
|
|
23
|
+');
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ /**
|
|
27
|
+ * Reverse the migrations.
|
|
28
|
+ *
|
|
29
|
+ * @return void
|
|
30
|
+ */
|
|
31
|
+ public function down()
|
|
32
|
+ {
|
|
33
|
+ //
|
|
34
|
+ DB::statement('DROP VIEW IF EXISTS student_criteria_achieved');
|
|
35
|
+
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+}
|