|
@@ -43,164 +43,169 @@ class OutcomesController extends \BaseController
|
43
|
43
|
$undergradResults = array("names" => array(), "schools" => array(), "achieved" => array(), "attempted" => array(), "successRate" => array());
|
44
|
44
|
$gradResults = array("names" => array(), "schools" => array(), "achieved" => array(), "attempted" => array(), "successRate" => array());
|
45
|
45
|
foreach ($programs as $program_id) {
|
46
|
|
- // var_dump($program_id);
|
47
|
|
- // exit();
|
48
|
|
- $program = Program::where('id', '=', $program_id->id)->first();
|
49
|
|
- $school = School::where('id', '=', $program->school_id)->first();
|
50
|
|
- if ($program->is_graduate) {
|
51
|
|
- $gradResults['names'][] = $program->name;
|
52
|
|
- $gradResults['schools'][] = $school->name;
|
53
|
|
- $attempted = $program->attempted_criteria_by_outcome($id, $selected_semesters);
|
54
|
|
- $gradResults['attempted'][] = $attempted;
|
55
|
|
- $achieved = $program->achieved_criteria_by_outcome($id, $selected_semesters);
|
56
|
|
- $gradResults['achieved'][] = $achieved;
|
57
|
|
- $gradResults['successRate'][] = sprintf("%.2f", 100 * $achieved / $attempted);
|
58
|
|
- } else {
|
59
|
|
- $undergradResults['names'][] = $program->name;
|
60
|
|
- $undergradResults['schools'][] = $school->name;
|
61
|
|
- $attempted = $program->attempted_criteria_by_outcome($id, $selected_semesters);
|
62
|
|
- $undergradResults['attempted'][] = $attempted;
|
63
|
|
- $achieved = $program->achieved_criteria_by_outcome($id, $selected_semesters);
|
64
|
|
- $undergradResults['achieved'][] = $achieved;
|
65
|
|
- $undergradResults['successRate'][] = sprintf("%.2f", 100 * $achieved / $attempted);
|
66
|
|
- }
|
|
46
|
+ // var_dump($program_id);
|
|
47
|
+// exit();
|
|
48
|
+ $program = Program::where('id', '=', $program_id->id)->first();
|
|
49
|
+ $school = School::where('id', '=', $program->school_id)->first();
|
|
50
|
+ if($program->is_graduate)
|
|
51
|
+ {
|
|
52
|
+ $gradResults['names'][] = $program->name;
|
|
53
|
+ $gradResults['schools'][] = $school->name;
|
|
54
|
+ $attempted = $program->attempted_criteria_by_outcome($id, $selected_semesters);
|
|
55
|
+ $gradResults['attempted'][] = $attempted;
|
|
56
|
+ $achieved = $program->achieved_criteria_by_outcome($id, $selected_semesters);
|
|
57
|
+ $gradResults['achieved'][] = $achieved;
|
|
58
|
+ $gradResults['successRate'][] = sprintf("%.2f",100*$achieved/$attempted);
|
|
59
|
+
|
|
60
|
+ }
|
|
61
|
+ else
|
|
62
|
+ {
|
|
63
|
+ $undergradResults['names'][] = $program->name;
|
|
64
|
+ $undergradResults['schools'][] = $school->name;
|
|
65
|
+ $attempted = $program->attempted_criteria_by_outcome($id,$selected_semesters);
|
|
66
|
+ $undergradResults['attempted'][] = $attempted;
|
|
67
|
+ $achieved = $program->achieved_criteria_by_outcome($id,$selected_semesters);
|
|
68
|
+ $undergradResults['achieved'][] = $achieved;
|
|
69
|
+ $undergradResults['successRate'][] = sprintf("%.2f",100*$achieved/$attempted);
|
|
70
|
+ }
|
|
71
|
+
|
67
|
72
|
}
|
68
|
73
|
|
69
|
|
- $title = "Outcome Results: " . $outcome->name;
|
|
74
|
+ $title = "Outcome Results: ".$outcome->name;
|
70
|
75
|
|
71
|
76
|
|
72
|
|
- // $undergradResults["successRate"]
|
|
77
|
+// $undergradResults["successRate"]
|
73
|
78
|
|
74
|
79
|
return View::make('local.managers.admins.learning-outcome_new', compact('title', 'outcome', 'undergradResults', 'gradResults'));
|
75
|
80
|
}
|
76
|
81
|
|
77
|
|
- // public function show($id)
|
78
|
|
- // {
|
79
|
|
- // DB::disableQueryLog();
|
80
|
|
- // $outcome = Outcome::find($id);
|
81
|
|
- //
|
82
|
|
- // $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
83
|
|
- // $gradResults = array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
84
|
|
- //
|
85
|
|
- // //Calculate performance for this outcome for each undergrad program
|
86
|
|
- // $undergradPrograms = Program::where('is_graduate','=', 0)
|
87
|
|
- // ->where(function($query)
|
88
|
|
- // {
|
89
|
|
- // if(Auth::user()->school_id)
|
90
|
|
- // {
|
91
|
|
- // $query->where('school_id', Auth::user()->school_id);
|
92
|
|
- // }
|
93
|
|
- // })
|
94
|
|
- // ->with('courses')
|
95
|
|
- // ->orderBy('name', 'asc')->get();
|
96
|
|
- //
|
97
|
|
- // foreach($undergradPrograms as $program)
|
98
|
|
- // {
|
99
|
|
- // $undergradResults["names"][$program->id]=$program->name;
|
100
|
|
- // $undergradResults["schools"][$program->id]=$program->school->name;
|
101
|
|
- // $programAssessed=false;
|
102
|
|
- //
|
103
|
|
- // $undergradResults["attempted"][$program->id]=0;
|
104
|
|
- // $undergradResults["achieved"][$program->id]=0;
|
105
|
|
- //
|
106
|
|
- // foreach($program->courses as $course)
|
107
|
|
- // {
|
108
|
|
- // $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
109
|
|
- // $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
110
|
|
- //
|
111
|
|
- // $attemptedCriteriaCount=0;
|
112
|
|
- // $achievedCriteriaCount=0;
|
113
|
|
- //
|
114
|
|
- // // If this outcome was evaluated
|
115
|
|
- // if(
|
116
|
|
- // $course_outcomes_attempted
|
117
|
|
- // && array_key_exists($outcome->id, $course_outcomes_attempted)
|
118
|
|
- // && $course_outcomes_attempted[$outcome->id]!=0)
|
119
|
|
- // {
|
120
|
|
- // // Count +1 for attempted and achieved in the program
|
121
|
|
- // $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
122
|
|
- // $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
123
|
|
- // $programAssessed=true;
|
124
|
|
- //
|
125
|
|
- // if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
126
|
|
- // {
|
127
|
|
- // $undergradResults["achieved"][$program->id]+=1;
|
128
|
|
- // }
|
129
|
|
- // $undergradResults["attempted"][$program->id]+=1;
|
130
|
|
- // }
|
131
|
|
- // }
|
132
|
|
- //
|
133
|
|
- // // Calculate success rate for this program
|
134
|
|
- // if($programAssessed && $undergradResults["attempted"][$program->id]>0)
|
135
|
|
- // $undergradResults["successRate"][$program->id]= round((float)$undergradResults["achieved"][$program->id]/$undergradResults["attempted"][$program->id]*100, 2).'%';
|
136
|
|
- // else
|
137
|
|
- // $undergradResults["successRate"][$program->id]= 'N/M';
|
138
|
|
- // }
|
139
|
|
- //
|
140
|
|
- //
|
141
|
|
- // //Calculate performance for this outcome for each grad program
|
142
|
|
- // $gradPrograms = Program::where('is_graduate','=', 1)
|
143
|
|
- // ->where(function($query)
|
144
|
|
- // {
|
145
|
|
- // if(Auth::user()->school_id)
|
146
|
|
- // {
|
147
|
|
- // $query->where('school_id', Auth::user()->school_id);
|
148
|
|
- // }
|
149
|
|
- // })
|
150
|
|
- // ->with(array('courses'=>function($query)
|
151
|
|
- // {
|
152
|
|
- // $query->whereNotNull('outcomes_attempted');
|
153
|
|
- // }))
|
154
|
|
- // ->orderBy('name', 'asc')->get();
|
155
|
|
- //
|
156
|
|
- // foreach($gradPrograms as $program)
|
157
|
|
- // {
|
158
|
|
- // $gradResults["names"][$program->id]=$program->name;
|
159
|
|
- // $gradResults["schools"][$program->id]=$program->school->name;
|
160
|
|
- //
|
161
|
|
- // $programAssessed=false;
|
162
|
|
- //
|
163
|
|
- // $gradResults["attempted"][$program->id]=0;
|
164
|
|
- // $gradResults["achieved"][$program->id]=0;
|
165
|
|
- //
|
166
|
|
- // foreach($program->courses as $course)
|
167
|
|
- // {
|
168
|
|
- // $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
169
|
|
- // $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
170
|
|
- //
|
171
|
|
- // $attemptedCriteriaCount=0;
|
172
|
|
- // $achievedCriteriaCount=0;
|
173
|
|
- //
|
174
|
|
- // // If this outcome was evaluated
|
175
|
|
- // if(
|
176
|
|
- // $course_outcomes_attempted
|
177
|
|
- // && array_key_exists($outcome->id, $course_outcomes_attempted)
|
178
|
|
- // && $course_outcomes_attempted[$outcome->id]!=0)
|
179
|
|
- // {
|
180
|
|
- // // Count +1 for attempted and achieved in the program
|
181
|
|
- // $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
182
|
|
- // $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
183
|
|
- // $programAssessed=true;
|
184
|
|
- //
|
185
|
|
- // if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
186
|
|
- // {
|
187
|
|
- // $gradResults["achieved"][$program->id]+=1;
|
188
|
|
- // }
|
189
|
|
- // $gradResults["attempted"][$program->id]+=1;
|
190
|
|
- // }
|
191
|
|
- // }
|
192
|
|
- //
|
193
|
|
- // // Calculate success rate for this program
|
194
|
|
- // if($programAssessed && $gradResults["attempted"][$program->id]>0)
|
195
|
|
- // $gradResults["successRate"][$program->id]= round((float)$gradResults["achieved"][$program->id]/$gradResults["attempted"][$program->id]*100, 2).'%';
|
196
|
|
- // else
|
197
|
|
- // $gradResults["successRate"][$program->id]= 'N/M';
|
198
|
|
- // }
|
199
|
|
- //
|
200
|
|
- // $title = "Outcome Results: ".$outcome->name;
|
201
|
|
- //
|
202
|
|
- // return View::make('local.managers.admins.learning-outcome', compact('title', 'outcome', 'undergradResults', 'gradResults'));
|
203
|
|
- // }
|
|
82
|
+// public function show($id)
|
|
83
|
+// {
|
|
84
|
+// DB::disableQueryLog();
|
|
85
|
+// $outcome = Outcome::find($id);
|
|
86
|
+//
|
|
87
|
+// $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
|
88
|
+// $gradResults = array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
|
89
|
+//
|
|
90
|
+// //Calculate performance for this outcome for each undergrad program
|
|
91
|
+// $undergradPrograms = Program::where('is_graduate','=', 0)
|
|
92
|
+// ->where(function($query)
|
|
93
|
+// {
|
|
94
|
+// if(Auth::user()->school_id)
|
|
95
|
+// {
|
|
96
|
+// $query->where('school_id', Auth::user()->school_id);
|
|
97
|
+// }
|
|
98
|
+// })
|
|
99
|
+// ->with('courses')
|
|
100
|
+// ->orderBy('name', 'asc')->get();
|
|
101
|
+//
|
|
102
|
+// foreach($undergradPrograms as $program)
|
|
103
|
+// {
|
|
104
|
+// $undergradResults["names"][$program->id]=$program->name;
|
|
105
|
+// $undergradResults["schools"][$program->id]=$program->school->name;
|
|
106
|
+// $programAssessed=false;
|
|
107
|
+//
|
|
108
|
+// $undergradResults["attempted"][$program->id]=0;
|
|
109
|
+// $undergradResults["achieved"][$program->id]=0;
|
|
110
|
+//
|
|
111
|
+// foreach($program->courses as $course)
|
|
112
|
+// {
|
|
113
|
+// $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
|
114
|
+// $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
|
115
|
+//
|
|
116
|
+// $attemptedCriteriaCount=0;
|
|
117
|
+// $achievedCriteriaCount=0;
|
|
118
|
+//
|
|
119
|
+// // If this outcome was evaluated
|
|
120
|
+// if(
|
|
121
|
+// $course_outcomes_attempted
|
|
122
|
+// && array_key_exists($outcome->id, $course_outcomes_attempted)
|
|
123
|
+// && $course_outcomes_attempted[$outcome->id]!=0)
|
|
124
|
+// {
|
|
125
|
+// // Count +1 for attempted and achieved in the program
|
|
126
|
+// $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
|
127
|
+// $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
|
128
|
+// $programAssessed=true;
|
|
129
|
+//
|
|
130
|
+// if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
|
131
|
+// {
|
|
132
|
+// $undergradResults["achieved"][$program->id]+=1;
|
|
133
|
+// }
|
|
134
|
+// $undergradResults["attempted"][$program->id]+=1;
|
|
135
|
+// }
|
|
136
|
+// }
|
|
137
|
+//
|
|
138
|
+// // Calculate success rate for this program
|
|
139
|
+// if($programAssessed && $undergradResults["attempted"][$program->id]>0)
|
|
140
|
+// $undergradResults["successRate"][$program->id]= round((float)$undergradResults["achieved"][$program->id]/$undergradResults["attempted"][$program->id]*100, 2).'%';
|
|
141
|
+// else
|
|
142
|
+// $undergradResults["successRate"][$program->id]= 'N/M';
|
|
143
|
+// }
|
|
144
|
+//
|
|
145
|
+//
|
|
146
|
+// //Calculate performance for this outcome for each grad program
|
|
147
|
+// $gradPrograms = Program::where('is_graduate','=', 1)
|
|
148
|
+// ->where(function($query)
|
|
149
|
+// {
|
|
150
|
+// if(Auth::user()->school_id)
|
|
151
|
+// {
|
|
152
|
+// $query->where('school_id', Auth::user()->school_id);
|
|
153
|
+// }
|
|
154
|
+// })
|
|
155
|
+// ->with(array('courses'=>function($query)
|
|
156
|
+// {
|
|
157
|
+// $query->whereNotNull('outcomes_attempted');
|
|
158
|
+// }))
|
|
159
|
+// ->orderBy('name', 'asc')->get();
|
|
160
|
+//
|
|
161
|
+// foreach($gradPrograms as $program)
|
|
162
|
+// {
|
|
163
|
+// $gradResults["names"][$program->id]=$program->name;
|
|
164
|
+// $gradResults["schools"][$program->id]=$program->school->name;
|
|
165
|
+//
|
|
166
|
+// $programAssessed=false;
|
|
167
|
+//
|
|
168
|
+// $gradResults["attempted"][$program->id]=0;
|
|
169
|
+// $gradResults["achieved"][$program->id]=0;
|
|
170
|
+//
|
|
171
|
+// foreach($program->courses as $course)
|
|
172
|
+// {
|
|
173
|
+// $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
|
174
|
+// $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
|
175
|
+//
|
|
176
|
+// $attemptedCriteriaCount=0;
|
|
177
|
+// $achievedCriteriaCount=0;
|
|
178
|
+//
|
|
179
|
+// // If this outcome was evaluated
|
|
180
|
+// if(
|
|
181
|
+// $course_outcomes_attempted
|
|
182
|
+// && array_key_exists($outcome->id, $course_outcomes_attempted)
|
|
183
|
+// && $course_outcomes_attempted[$outcome->id]!=0)
|
|
184
|
+// {
|
|
185
|
+// // Count +1 for attempted and achieved in the program
|
|
186
|
+// $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
|
187
|
+// $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
|
188
|
+// $programAssessed=true;
|
|
189
|
+//
|
|
190
|
+// if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
|
191
|
+// {
|
|
192
|
+// $gradResults["achieved"][$program->id]+=1;
|
|
193
|
+// }
|
|
194
|
+// $gradResults["attempted"][$program->id]+=1;
|
|
195
|
+// }
|
|
196
|
+// }
|
|
197
|
+//
|
|
198
|
+// // Calculate success rate for this program
|
|
199
|
+// if($programAssessed && $gradResults["attempted"][$program->id]>0)
|
|
200
|
+// $gradResults["successRate"][$program->id]= round((float)$gradResults["achieved"][$program->id]/$gradResults["attempted"][$program->id]*100, 2).'%';
|
|
201
|
+// else
|
|
202
|
+// $gradResults["successRate"][$program->id]= 'N/M';
|
|
203
|
+// }
|
|
204
|
+//
|
|
205
|
+// $title = "Outcome Results: ".$outcome->name;
|
|
206
|
+//
|
|
207
|
+// return View::make('local.managers.admins.learning-outcome', compact('title', 'outcome', 'undergradResults', 'gradResults'));
|
|
208
|
+// }
|
204
|
209
|
|
205
|
210
|
// TODO: Clean up and verify relationships are correct
|
206
|
211
|
public function newShow($id)
|
|
@@ -513,14 +518,78 @@ class OutcomesController extends \BaseController
|
513
|
518
|
|
514
|
519
|
public function fetchOutcome()
|
515
|
520
|
{
|
516
|
|
- $id = Input::get('id');
|
|
521
|
+ // original code using models
|
|
522
|
+ // TODO: models have to be updated because of the database update
|
517
|
523
|
|
518
|
|
- $outcome = Outcome::find($id);
|
|
524
|
+ $id = Input::get('id');
|
519
|
525
|
|
520
|
|
- $outcome->criteria;
|
|
526
|
+ $outcome_info = DB::table('outcomes')
|
|
527
|
+ ->where('outcomes.id', $id)
|
|
528
|
+ ->get();
|
|
529
|
+ $outcome = $outcome_info[0];
|
|
530
|
+
|
|
531
|
+ $diferent_levels = DB::table('criterion_objective_outcome')
|
|
532
|
+ ->join('new_criteria', 'new_criteria.id', '=', 'criterion_objective_outcome.criterion_id')
|
|
533
|
+ ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
|
|
534
|
+ ->where('criterion_objective_outcome.outcome_id', $id)
|
|
535
|
+ ->distinct('new_criteria.number_of_scales')
|
|
536
|
+ ->select('new_criteria.number_of_scales as levels')
|
|
537
|
+ ->orderBy('new_criteria.number_of_scales', 'asc')
|
|
538
|
+ ->get();
|
521
|
539
|
|
522
|
|
- return array(
|
523
|
|
- 'outcome' => $outcome
|
|
540
|
+ $criteria_array = array();
|
|
541
|
+
|
|
542
|
+ $outcome->criteria = array();
|
|
543
|
+ foreach ($diferent_levels as $level) {
|
|
544
|
+ $level = $level->levels;
|
|
545
|
+
|
|
546
|
+ // buscar todos los criterios con el level y ponerlos en un array
|
|
547
|
+ $outcome_criterias = DB::table('criterion_objective_outcome')
|
|
548
|
+ ->join('new_criteria', 'new_criteria.id', '=', 'criterion_objective_outcome.criterion_id')
|
|
549
|
+ ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
|
|
550
|
+ ->where('criterion_objective_outcome.outcome_id', $id)
|
|
551
|
+ ->where('new_criteria.number_of_scales', $level)
|
|
552
|
+ ->whereNull('new_criteria.deleted_at')
|
|
553
|
+ ->select('new_criteria.id','new_criteria.name')
|
|
554
|
+ ->orderBy('new_criteria.name', 'asc')
|
|
555
|
+ ->get();
|
|
556
|
+ $outcome_criterias = $outcome_criterias;
|
|
557
|
+
|
|
558
|
+ foreach ($outcome_criterias as $criteria_id) {
|
|
559
|
+
|
|
560
|
+ $scales =
|
|
561
|
+ DB::select(
|
|
562
|
+ DB::raw("
|
|
563
|
+ SELECT *
|
|
564
|
+ FROM (
|
|
565
|
+ SELECT new_criteria.id as criterion_id,
|
|
566
|
+ ROW_NUMBER() OVER(PARTITION BY scales.id) rn,
|
|
567
|
+ scales.position,
|
|
568
|
+ scales.title, scales.description,
|
|
569
|
+ criterion_objective_outcome.outcome_id,criterion_objective_outcome.objective_id,
|
|
570
|
+ criterion_scale.scale_id
|
|
571
|
+ FROM new_criteria,criterion_scale,scales, criterion_objective_outcome, objectives
|
|
572
|
+ where new_criteria.id=criterion_scale.criterion_id
|
|
573
|
+ and scales.id = criterion_scale.scale_id
|
|
574
|
+ and new_criteria.id = criterion_objective_outcome.criterion_id
|
|
575
|
+ and objectives.id = criterion_objective_outcome.objective_id
|
|
576
|
+ and criterion_objective_outcome.outcome_id = $id
|
|
577
|
+ and new_criteria.id = $criteria_id->id
|
|
578
|
+ ORDER BY new_criteria.name ASC) a
|
|
579
|
+ WHERE rn = 1
|
|
580
|
+ ORDER BY `a`.`position` ASC
|
|
581
|
+ ")
|
|
582
|
+ );
|
|
583
|
+ // insertar la informacion de los criterios con N niveles en el arreglo de arreglos
|
|
584
|
+ $criteria_id->scales = $scales;
|
|
585
|
+ // $i++;
|
|
586
|
+ }//ends foreach criteria_id
|
|
587
|
+ array_push($outcome->criteria, array($outcome_criterias,'amount_of_levels'=>$level));
|
|
588
|
+ }//ends foreach level
|
|
589
|
+
|
|
590
|
+ return array
|
|
591
|
+ (
|
|
592
|
+ 'outcome' => $outcome,
|
524
|
593
|
);
|
525
|
594
|
}
|
526
|
595
|
|