Browse Source

cambios con administrador

parent
commit
eeb589ff2a

+ 2
- 0
.gitignore View File

@@ -10,3 +10,5 @@ app/database/csv/*
10 10
 app/config/local/*
11 11
 app/config/app.php
12 12
 app/config/database.php
13
+node_modules/
14
+app/config/

+ 3
- 3
app/controllers/AuthController.php View File

@@ -28,9 +28,9 @@ class AuthController extends \BaseController {
28 28
 		if(!$validator->fails())
29 29
 		{
30 30
 //			TODO: Remove this for production environment
31
-            if (App::environment('local', 'staging')) {
32
-			    return $this->processLogin();
33
-            }
31
+//             if (App::environment('local', 'staging')) {
32
+// 			    return $this->processLogin();
33
+//             }
34 34
 			try {
35 35
 				// User input
36 36
 				$username = str_replace('@upr.edu', '', Input::get('email'));

+ 14
- 5
app/controllers/OutcomesController.php View File

@@ -567,14 +567,23 @@ class OutcomesController extends \BaseController
567 567
             $level = $level->levels;
568 568
 
569 569
             // buscar todos los criterios con el level y ponerlos en un array
570
+//             $outcome_criterias = DB::table('criterion_objective_outcome')
571
+//                 ->join('new_criteria', 'new_criteria.id', '=', 'criterion_objective_outcome.criterion_id')
572
+//                 ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
573
+//                 ->where('criterion_objective_outcome.outcome_id', $id)
574
+//                 ->where('new_criteria.number_of_scales', $level)
575
+//                 ->whereNull('new_criteria.deleted_at')
576
+//                 ->select('new_criteria.id', 'new_criteria.name')
577
+//                 ->orderBy('new_criteria.name', 'asc')
578
+//                 ->get();
570 579
             $outcome_criterias = DB::table('criterion_objective_outcome')
571
-                ->join('new_criteria', 'new_criteria.id', '=', 'criterion_objective_outcome.criterion_id')
580
+                ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
572 581
                 ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
573 582
                 ->where('criterion_objective_outcome.outcome_id', $id)
574
-                ->where('new_criteria.number_of_scales', $level)
575
-                ->whereNull('new_criteria.deleted_at')
576
-                ->select('new_criteria.id', 'new_criteria.name')
577
-                ->orderBy('new_criteria.name', 'asc')
583
+                ->where('criteria.number_of_scales', $level)
584
+                ->whereNull('criteria.deleted_at')
585
+                ->select('criteria.id', 'criteria.name')
586
+                ->orderBy('criteria.name', 'asc')
578 587
                 ->get();
579 588
             $outcome_criterias = $outcome_criterias;
580 589
 

+ 32
- 8
app/models/Criterion.php View File

@@ -7,7 +7,8 @@ class Criterion extends Eloquent
7 7
     use SoftDeletingTrait;
8 8
     protected $dates = ['deleted_at'];
9 9
 
10
-    protected $table = 'new_criteria';
10
+//     protected $table = 'new_criteria';
11
+    protected $table = 'criteria';
11 12
 
12 13
     public function outcomes()
13 14
     {
@@ -24,7 +25,8 @@ class Criterion extends Eloquent
24 25
 
25 26
     public function rubrics()
26 27
     {
27
-        return $this->belongsToMany('Rubric', 'new_criterion_rubric');
28
+//         return $this->belongsToMany('Rubric', 'new_criterion_rubric');
29
+        return $this->belongsToMany('Rubric', 'criterion_rubric');
28 30
     }
29 31
 
30 32
 	/**
@@ -65,8 +67,13 @@ class Criterion extends Eloquent
65 67
 		foreach($activities_criterions as $activity_criterion)
66 68
 		{
67 69
 		
68
-			 $students_attempted+=DB::table('new_assessments')
69
-				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
70
+// 			 $students_attempted+=DB::table('new_assessments')
71
+// 				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
72
+// 				->where('activity_criterion.id',$activity_criterion->id)
73
+// 				->count();
74
+		
75
+			 $students_attempted+=DB::table('assessments')
76
+				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
70 77
 				->where('activity_criterion.id',$activity_criterion->id)
71 78
 				->count();
72 79
 		}
@@ -76,12 +83,23 @@ class Criterion extends Eloquent
76 83
 	public static function students_achieved($criterion_id,$activity_id)	
77 84
 	{
78 85
 		$students_achieved=0;
86
+// 		$activities_criterions=DB::table('activity_criterion')
87
+// 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
88
+// 			->join('courses', 'activities.course_id', '=', 'courses.id')
89
+// 			->where('activities.id','=',$activity_id)
90
+// 			->where('activity_criterion.criterion_id','=',$criterion_id)
91
+// 			->select('activity_criterion.id','expected_student_score')
92
+// 			->distinct()
93
+// 			->get();
94
+
79 95
 		$activities_criterions=DB::table('activity_criterion')
80 96
 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
81 97
 			->join('courses', 'activities.course_id', '=', 'courses.id')
98
+			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
99
+			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
82 100
 			->where('activities.id','=',$activity_id)
83 101
 			->where('activity_criterion.criterion_id','=',$criterion_id)
84
-			->select('activity_criterion.id','expected_student_score')
102
+			->select('activity_criterion.id','expected_points')
85 103
 			->distinct()
86 104
 			->get();
87 105
 			
@@ -89,10 +107,16 @@ class Criterion extends Eloquent
89 107
 		{
90 108
 		
91 109
 // 			$expected_student_score=DB::table('new_criteria')->where('id',$criterion_id)->select('expected_student_score')->get();
92
-			 $students_achieved+=DB::table('new_assessments')
93
-				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
110
+// 			 $students_achieved+=DB::table('new_assessments')
111
+// 				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
112
+// 				->where('activity_criterion.id',$activity_criterion->id)
113
+// 				->where('new_assessments.score','>=',$activity_criterion->expected_student_score)
114
+// 				->count();
115
+
116
+			 $students_achieved+=DB::table('assessments')
117
+				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
94 118
 				->where('activity_criterion.id',$activity_criterion->id)
95
-				->where('new_assessments.score','>=',$activity_criterion->expected_student_score)
119
+				->where('assessments.score','>=',$activity_criterion->expected_points)
96 120
 				->count();
97 121
 		}
98 122
 		return $students_achieved;

+ 90
- 20
app/models/Outcome.php View File

@@ -65,7 +65,7 @@ class Outcome extends Eloquent
65 65
 // 		}
66 66
 // 		return $conteo;
67 67
 // 	}
68
-	public function active_by_semesters($selected_semesters, $level)
68
+	public static function active_by_semesters($selected_semesters, $level)
69 69
 	{
70 70
 		$min_start="9000-01-01 00:00:00";
71 71
 		$max_end="1000-01-01 00:00:00";
@@ -105,12 +105,24 @@ class Outcome extends Eloquent
105 105
 		{
106 106
 			$semesters_array[]=$semester->id;
107 107
 		}
108
+// 		 $programs=DB::table('programs')
109
+// 	    	->join('courses', 'programs.id', '=', 'courses.program_id')
110
+// 	    	->join('activities', 'activities.course_id', '=', 'courses.id')
111
+// 	    	->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
112
+// 	    	->join('new_criteria', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
113
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
114
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
115
+// 	    	->whereIn('courses.semester_id',$semesters_array)
116
+// 	    	->distinct()
117
+// 	    	->select('programs.id')
118
+// 	    	->get()
119
+// 			;
108 120
 		 $programs=DB::table('programs')
109 121
 	    	->join('courses', 'programs.id', '=', 'courses.program_id')
110 122
 	    	->join('activities', 'activities.course_id', '=', 'courses.id')
111 123
 	    	->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
112
-	    	->join('new_criteria', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
113
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
124
+	    	->join('criteria', 'activity_criterion.criterion_id', '=', 'criteria.id')
125
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
114 126
 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
115 127
 	    	->whereIn('courses.semester_id',$semesters_array)
116 128
 	    	->distinct()
@@ -129,16 +141,31 @@ class Outcome extends Eloquent
129 141
 		{
130 142
 			$semesters_array[]=$semester->id;
131 143
 		}
132
-		 $criteria=DB::table('new_criteria')
133
-	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
144
+// 		 $criteria=DB::table('new_criteria')
145
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
146
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
147
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
148
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
149
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
150
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
151
+// 	    	->where('programs.is_graduate','=',$is_grad)
152
+// 	    	->whereIn('courses.semester_id',$semesters_array)
153
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
154
+// 	    	->distinct()
155
+// 	    	->get()
156
+// 			;
157
+		 $criteria=DB::table('criteria')
158
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
134 159
 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
135 160
 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
136 161
 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
137
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
162
+	    	->join('rubric_activity', 'activities.id', '=', 'rubric_activity.activity_id')
163
+	    	->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
164
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
138 165
 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
139 166
 	    	->where('programs.is_graduate','=',$is_grad)
140 167
 	    	->whereIn('courses.semester_id',$semesters_array)
141
-	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
168
+	    	->select('criteria.id','expected_percentage','activity_criterion.activity_id')
142 169
 	    	->distinct()
143 170
 	    	->get()
144 171
 			;
@@ -165,15 +192,29 @@ class Outcome extends Eloquent
165 192
 // 		exit();
166 193
 			$courses_array[]=$course->id;
167 194
 		}
168
-		 $criteria=DB::table('new_criteria')
169
-	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
195
+// 		 $criteria=DB::table('new_criteria')
196
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
197
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
198
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
199
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
200
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
201
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
202
+// 	    	->whereIn('courses.id',$courses_array)
203
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
204
+// 	    	->distinct()
205
+// 	    	->get()
206
+// 			;
207
+		 $criteria=DB::table('criteria')
208
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
170 209
 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
171 210
 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
172 211
 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
173
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
212
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
213
+			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
214
+			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
174 215
 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
175 216
 	    	->whereIn('courses.id',$courses_array)
176
-	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
217
+	    	->select('criteria.id','expected_percentage','activity_criterion.activity_id')
177 218
 	    	->distinct()
178 219
 	    	->get()
179 220
 			;
@@ -199,15 +240,29 @@ class Outcome extends Eloquent
199 240
 			$courses_array[]=$course->id;
200 241
 		}
201 242
 
202
-		 $criteria=DB::table('new_criteria')
203
-	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
243
+// 		 $criteria=DB::table('new_criteria')
244
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
245
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
246
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
247
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
248
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
249
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
250
+// 	    	->whereIn('courses.id',$courses_array)
251
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
252
+// 	    	->distinct()
253
+// 	    	->get()
254
+// 			;
255
+		 $criteria=DB::table('criteria')
256
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
204 257
 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
205 258
 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
206 259
 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
207
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
260
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
261
+			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
262
+			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
208 263
 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
209 264
 	    	->whereIn('courses.id',$courses_array)
210
-	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
265
+	    	->select('criteria.id','expected_percentage','activity_criterion.activity_id')
211 266
 	    	->distinct()
212 267
 	    	->get()
213 268
 			;
@@ -244,16 +299,31 @@ class Outcome extends Eloquent
244 299
 		}
245 300
 
246 301
 //   DB::enableQueryLog();
247
-		 $criteria=DB::table('new_criteria')
248
-	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
302
+// 		 $criteria=DB::table('new_criteria')
303
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
304
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
305
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
306
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
307
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
308
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
309
+// 	    	->where('programs.is_graduate','=',$is_grad)
310
+// 	    	->whereIn('courses.semester_id',$semesters_array)
311
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
312
+// 	    	->distinct()
313
+// 	    	->get()
314
+// 			;
315
+		 $criteria=DB::table('criteria')
316
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
249 317
 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
250 318
 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
251 319
 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
252
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
320
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
321
+			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
322
+			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
253 323
 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
254 324
 	    	->where('programs.is_graduate','=',$is_grad)
255 325
 	    	->whereIn('courses.semester_id',$semesters_array)
256
-	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
326
+	    	->select('criteria.id','expected_percentage','activity_criterion.activity_id')
257 327
 	    	->distinct()
258 328
 	    	->get()
259 329
 			;
@@ -273,7 +343,7 @@ class Outcome extends Eloquent
273 343
 			{
274 344
 				$percentage_students_who_achieved=0;
275 345
 			}
276
-			if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
346
+			if($percentage_students_who_achieved>=$criterion->expected_percentage)
277 347
 			{
278 348
 				$conteo++;
279 349
 			}

+ 44
- 10
app/models/Program.php View File

@@ -169,19 +169,36 @@ class Program extends Eloquent
169 169
 		
170 170
 //   DB::enableQueryLog();
171 171
 // 		dd(DB::getQueryLog());
172
-		 $criteria=DB::table('new_criteria')
173
-	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
172
+// 		 $criteria=DB::table('new_criteria')
173
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
174
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
175
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
176
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
177
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
178
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
179
+// 	    	->where('programs.id','=',$this->id)
180
+// 	    	->whereIn('courses.semester_id',$semesters_array)
181
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
182
+// 	    	->distinct()
183
+// 	    	->get()
184
+// 			;
185
+
186
+		 $criteria=DB::table('criteria')
187
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
174 188
 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
175 189
 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
176 190
 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
177
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
191
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
192
+			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
193
+			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
178 194
 	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
179 195
 	    	->where('programs.id','=',$this->id)
180 196
 	    	->whereIn('courses.semester_id',$semesters_array)
181
-	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
197
+	    	->select('criteria.id','expected_percentage','activity_criterion.activity_id')
182 198
 	    	->distinct()
183 199
 	    	->get()
184 200
 			;
201
+
185 202
 // 		dd(DB::getQueryLog());
186 203
 		 
187 204
 		$conteo=0;
@@ -217,7 +234,7 @@ class Program extends Eloquent
217 234
 				{
218 235
 					$percentage_students_who_achieved=0;
219 236
 				}
220
-				if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
237
+				if($percentage_students_who_achieved>=$criterion->expected_percentage)
221 238
 				{
222 239
 					$conteo++;
223 240
 				}
@@ -246,19 +263,36 @@ class Program extends Eloquent
246 263
 		
247 264
 //   DB::enableQueryLog();
248 265
 // 		dd(DB::getQueryLog());
249
-		 $criteria=DB::table('new_criteria')
250
-	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
266
+// 		 $criteria=DB::table('new_criteria')
267
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
268
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
269
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
270
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
271
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
272
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
273
+// 	    	->where('programs.id','=',$this->id)
274
+// 	    	->whereIn('courses.semester_id',$semesters_array)
275
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
276
+// 	    	->distinct()
277
+// 	    	->get()
278
+// 			;
279
+			
280
+		 $criteria=DB::table('criteria')
281
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
251 282
 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
252 283
 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
253 284
 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
254
-	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
285
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
286
+			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
287
+			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
255 288
 	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
256 289
 	    	->where('programs.id','=',$this->id)
257 290
 	    	->whereIn('courses.semester_id',$semesters_array)
258
-	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
291
+	    	->select('criteria.id','expected_percentage','activity_criterion.activity_id')
259 292
 	    	->distinct()
260 293
 	    	->get()
261 294
 			;
295
+
262 296
 // 		dd(DB::getQueryLog());
263 297
 		 
264 298
 		$conteo=0;
@@ -294,7 +328,7 @@ class Program extends Eloquent
294 328
 				{
295 329
 					$percentage_students_who_achieved=0;
296 330
 				}
297
-				if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
331
+				if($percentage_students_who_achieved>=$criterion->expected_percentage)
298 332
 				{
299 333
 					$conteo++;
300 334
 				}