浏览代码

incluyendo los migrations de los views necesarios para overview

父节点
当前提交
c7c2fc6dc5

+ 39
- 0
app/database/migrations/2021_10_18_115610_student_criteria_evaluated_view.php 查看文件

@@ -0,0 +1,39 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class StudentCriteriaEvaluatedView extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+DB::statement("
16
+		   CREATE VIEW `student_criteria_evaluated`
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_evaluated`
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 (`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
+	/**
28
+	 * Reverse the migrations.
29
+	 *
30
+	 * @return void
31
+	 */
32
+	public function down()
33
+	{
34
+		//
35
+		    DB::statement('DROP VIEW IF EXISTS student_criteria_evaluated');
36
+
37
+	}
38
+
39
+}

+ 38
- 0
app/database/migrations/2021_10_18_120007_student_criteria_achieved_view.php 查看文件

@@ -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
+}

+ 37
- 0
app/database/migrations/2021_10_18_125837_student_outcome_assess_view.php 查看文件

@@ -0,0 +1,37 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class StudentOutcomeAssessView extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		//
16
+		   DB::statement("
17
+		   CREATE VIEW `student_outcome_assess`
18
+AS SELECT
19
+   `eval`.`student_id` AS `student_id`,
20
+   `eval`.`semester_id` AS `semester_id`,
21
+   `eval`.`outcome_id` AS `outcome_id`,sum(`eval`.`total_evaluated`) AS `total_evaluated`,sum(coalesce(`ach`.`total_achieved`,0)) AS `total_achieved`
22
+FROM (`student_criteria_evaluated` `eval` left join `student_criteria_achieved` `ach` on(((`eval`.`student_id` = `ach`.`student_id`) and (`eval`.`semester_id` = `ach`.`semester_id`) and (`eval`.`criterion_id` = `ach`.`criterion_id`) and (`eval`.`outcome_id` = `ach`.`outcome_id`)))) group by `eval`.`student_id`,`eval`.`semester_id`,`eval`.`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_outcome_assess');
35
+	}
36
+
37
+}