|
@@ -25,7 +25,198 @@ class SchoolCoordinatorsController extends \BaseController
|
25
|
25
|
// ->lists('id');
|
26
|
26
|
}
|
27
|
27
|
|
28
|
|
- public function overview()
|
|
28
|
+ public function overview_test()
|
|
29
|
+ {
|
|
30
|
+ ini_set('memory_limit', '256M');
|
|
31
|
+ DB::connection()->disableQueryLog();
|
|
32
|
+ // $school = School::find($id);
|
|
33
|
+ $school = Auth::user()->school;
|
|
34
|
+ $id = $school->id;
|
|
35
|
+
|
|
36
|
+ $title = $school->name;
|
|
37
|
+ $schools = School::all();
|
|
38
|
+
|
|
39
|
+ $semesters = Semester::whereIn('id', Session::get('semesters_ids'))->get();
|
|
40
|
+
|
|
41
|
+ $outcomes_grad = Outcome::active_by_semesters($semesters, 1);
|
|
42
|
+ $outcomes_undergrad = Outcome::active_by_semesters($semesters, 0);
|
|
43
|
+
|
|
44
|
+ /**
|
|
45
|
+ * List of grouped courses (grouped sections)
|
|
46
|
+ */
|
|
47
|
+
|
|
48
|
+ $program_ids = $school->programs->lists('id');
|
|
49
|
+
|
|
50
|
+ $undergrad_programs = DB::table('programs')
|
|
51
|
+ ->select('id', 'name', 'school_id', 'is_graduate')
|
|
52
|
+ ->where('is_graduate', '=', 0)
|
|
53
|
+ ->where('school_id', '=', $id)
|
|
54
|
+ ->orderBy('name', 'ASC')
|
|
55
|
+ ->get();
|
|
56
|
+
|
|
57
|
+ $grad_programs = DB::table('programs')
|
|
58
|
+ ->select('id', 'name', 'school_id', 'is_graduate')
|
|
59
|
+ ->where('is_graduate', '=', 1)
|
|
60
|
+ ->where('school_id', '=', $id)
|
|
61
|
+ ->orderBy('name', 'ASC')
|
|
62
|
+ ->get();
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+ $grad_grouped_courses = Course::
|
|
66
|
+ // select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
|
|
67
|
+ select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
|
|
68
|
+ ->with('semester')
|
|
69
|
+ ->with('program')
|
|
70
|
+ ->whereIn('courses.program_id', $program_ids)
|
|
71
|
+ ->whereIn('courses.semester_id', Session::get('semesters_ids'))
|
|
72
|
+ ->leftJoin('programs', 'courses.program_id', '=', 'programs.id')
|
|
73
|
+ ->where('programs.is_graduate', '=', 1)
|
|
74
|
+ ->groupBy(array('courses.code', 'courses.number', 'courses.semester_id'))
|
|
75
|
+ ->orderBy('courses.code')
|
|
76
|
+ ->orderBy('courses.number')
|
|
77
|
+ ->orderBy('courses.semester_id')
|
|
78
|
+ ->get();
|
|
79
|
+
|
|
80
|
+ $undergrad_grouped_courses = Course::
|
|
81
|
+ // select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
|
|
82
|
+ select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
|
|
83
|
+ ->with('semester')
|
|
84
|
+ ->with('program')
|
|
85
|
+ ->whereIn('courses.program_id', $program_ids)
|
|
86
|
+ ->whereIn('courses.semester_id', Session::get('semesters_ids'))
|
|
87
|
+ ->leftJoin('programs', 'courses.program_id', '=', 'programs.id')
|
|
88
|
+ ->where('programs.is_graduate', '=', 0)
|
|
89
|
+ ->groupBy(array('courses.code', 'courses.number', 'courses.semester_id'))
|
|
90
|
+ ->orderBy('courses.code')
|
|
91
|
+ ->orderBy('courses.number')
|
|
92
|
+ ->orderBy('courses.semester_id')
|
|
93
|
+ ->get();
|
|
94
|
+
|
|
95
|
+ foreach ($undergrad_grouped_courses as $key => $courses) {
|
|
96
|
+ $undergrad_grouped_courses[$key]->outcomes_attempted = NULL;
|
|
97
|
+ $coursesT = Course::where('courses.code', $courses->code)->where('courses.number', $courses->number)->where('courses.semester_id', $courses->semester_id)->get();
|
|
98
|
+ foreach ($coursesT as $course) {
|
|
99
|
+ if ($course->isAssessed()) {
|
|
100
|
+ $undergrad_grouped_courses[$key]->outcomes_attempted = true;
|
|
101
|
+ }
|
|
102
|
+ }
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ foreach ($grad_grouped_courses as $key => $courses) {
|
|
106
|
+ $grad_grouped_courses[$key]->outcomes_attempted = NULL;
|
|
107
|
+ $coursesT = Course::where('courses.code', $courses->code)->where('courses.number', $courses->number)->where('courses.semester_id', $courses->semester_id)->get();
|
|
108
|
+ foreach ($coursesT as $course) {
|
|
109
|
+ if ($course->isAssessed()) {
|
|
110
|
+ $grad_grouped_courses[$key]->outcomes_attempted = true;
|
|
111
|
+ }
|
|
112
|
+ }
|
|
113
|
+ }
|
|
114
|
+
|
|
115
|
+ // Fetch programs with participation
|
|
116
|
+ $participating_programs = $this->participatingPrograms($school);
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+ /**
|
|
120
|
+ * Calculate how many sections are doing assessment
|
|
121
|
+ */
|
|
122
|
+
|
|
123
|
+ $undergrad_assessed_sections_count = 0;
|
|
124
|
+ $undergrad_school_sections_count = 0;
|
|
125
|
+
|
|
126
|
+ $grad_assessed_sections_count = 0;
|
|
127
|
+ $grad_school_sections_count = 0;
|
|
128
|
+
|
|
129
|
+ foreach ($school->programs as $program) {
|
|
130
|
+ foreach ($program->courses as $course) {
|
|
131
|
+
|
|
132
|
+ if (!$course->program->is_graduate) {
|
|
133
|
+ $undergrad_school_sections_count += 1;
|
|
134
|
+ if ($course->isAssessed()) $undergrad_assessed_sections_count += 1;
|
|
135
|
+ } else {
|
|
136
|
+ $grad_school_sections_count += 1;
|
|
137
|
+ if ($course->isAssessed()) $grad_assessed_sections_count += 1;
|
|
138
|
+ }
|
|
139
|
+ }
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ /**
|
|
143
|
+ * Calculate how many programs achieved and attempted each outcome in this school
|
|
144
|
+ */
|
|
145
|
+
|
|
146
|
+ // For each outcome
|
|
147
|
+ foreach ($outcomes_undergrad as $outcome) {
|
|
148
|
+ // $attempted_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
149
|
+ // $achieved_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
150
|
+ $attemptedUndergradProgramsPerOutcome[$outcome->id] = 0;
|
|
151
|
+ $achievedUndergradProgramsPerOutcome[$outcome->id] = 0;
|
|
152
|
+ $programs_attempted_in_school[$outcome->id] = $outcome->programs_attempted_in_school($semesters, $school->id);
|
|
153
|
+ // var_dump($programs_attempted_in_school);exit();
|
|
154
|
+ foreach ($programs_attempted_in_school[$outcome->id] as $program_id) {
|
|
155
|
+ // var_dump($program_id->id);exit();
|
|
156
|
+ $program = DB::table('programs')->where('id', '=', $program_id->id)->first();
|
|
157
|
+
|
|
158
|
+ if (!$program->is_graduate) {
|
|
159
|
+ $attemptedUndergradProgramsPerOutcome[$outcome->id]++;
|
|
160
|
+ $programC = Program::where('id', '=', $program_id->id)->first();
|
|
161
|
+ // var_dump($programC);exit();
|
|
162
|
+ if ($programC->achieved_outcome($outcome->id, $semesters)) {
|
|
163
|
+ $achievedUndergradProgramsPerOutcome[$outcome->id]++;
|
|
164
|
+ }
|
|
165
|
+ }
|
|
166
|
+ }
|
|
167
|
+ $undergrad_outcomes_attempted[$outcome->id] = $outcome->attempted_by_school($semesters, $school->id, 0);
|
|
168
|
+ $undergrad_outcomes_achieved[$outcome->id] = $outcome->achieved_by_school($semesters, $school->id, 0);
|
|
169
|
+
|
|
170
|
+ // For each program with courses that do assessment
|
|
171
|
+ $programs_with_courses = Program::with(array('courses' => function ($query) {
|
|
172
|
+ // $query->whereNotNull('outcomes_attempted');
|
|
173
|
+ $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
174
|
+ }))->where('is_graduate', 0)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
|
|
175
|
+ }
|
|
176
|
+
|
|
177
|
+ /**
|
|
178
|
+ * Calculate how many programs achieved and attempted each outcome in this school
|
|
179
|
+ */
|
|
180
|
+
|
|
181
|
+ // For each outcome
|
|
182
|
+ foreach ($outcomes_grad as $outcome) {
|
|
183
|
+ // $attempted_outcomes_per_grad_program[$outcome->id]=0;
|
|
184
|
+ $achieved_outcomes_per_grad_program[$outcome->id] = 0;
|
|
185
|
+ $attemptedGradProgramsPerOutcome[$outcome->id] = 0;
|
|
186
|
+ $achievedGradProgramsPerOutcome[$outcome->id] = 0;
|
|
187
|
+ $grad_outcomes_attempted[$outcome->id] = $outcome->attempted_by_school($semesters, $school->id, 1);
|
|
188
|
+ $grad_outcomes_achieved[$outcome->id] = $outcome->achieved_by_school($semesters, $school->id, 1);
|
|
189
|
+ // For each program with courses that do assessment
|
|
190
|
+ foreach ($programs_attempted_in_school[$outcome->id] as $program_id) {
|
|
191
|
+ // var_dump($program_id->id);exit();
|
|
192
|
+ $program = DB::table('programs')
|
|
193
|
+ ->where('id', '=', $program_id->id)
|
|
194
|
+ ->first();
|
|
195
|
+ // $program=Program::where('id', $program_id->id);
|
|
196
|
+ // var_dump($program);exit();
|
|
197
|
+ if ($program->is_graduate) {
|
|
198
|
+ $attemptedGradProgramsPerOutcome[$outcome->id]++;
|
|
199
|
+ $programC = Program::where('id', '=', $program_id->id)->first();
|
|
200
|
+ // var_dump($programC);exit();
|
|
201
|
+ if ($programC->achieved_outcome($outcome->id, $semesters)) {
|
|
202
|
+ $achievedGradProgramsPerOutcome[$outcome->id]++;
|
|
203
|
+ }
|
|
204
|
+ }
|
|
205
|
+ }
|
|
206
|
+ $programs_with_courses = Program::with(array('courses' => function ($query) {
|
|
207
|
+ // $query->whereNotNull('outcomes_attempted');
|
|
208
|
+ $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
209
|
+ }))->where('is_graduate', 1)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
|
|
210
|
+ }
|
|
211
|
+ if ($school->id == 13) {
|
|
212
|
+ // return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
|
|
213
|
+ return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes_grad', 'outcomes_undergrad', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs'));
|
|
214
|
+ } else {
|
|
215
|
+ // return View::make('local.managers.shared.school', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
|
|
216
|
+ return View::make('local.managers.shared.schoolTest', compact('title', 'outcomes_grad', 'outcomes_undergrad', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs'));
|
|
217
|
+ }
|
|
218
|
+ }
|
|
219
|
+ public function overview()
|
29
|
220
|
{
|
30
|
221
|
ini_set('memory_limit', '256M');
|
31
|
222
|
DB::connection()->disableQueryLog();
|