123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752 |
- <?php
-
- class School extends Eloquent
- {
- public function programs()
- {
- return $this->hasMany('Program')->orderBy('name', 'asc');
- }
-
- public function coordinators()
- {
- return $this->hasMany('User');
- }
-
- public function courses()
- {
- return $this->hasManyThrough('Course', 'Program')->orderBy('name', 'asc');
- }
-
- public function templates()
- {
- return $this->hasMany('Template')->orderBy('name', 'asc');
- }
-
- public function getUndergraduateProgramsAttribute()
- {
-
- return $this->hasMany("Program")->where('is_graduate', 0)->orderBy("name", 'asc');
- }
- public function getGraduateProgramsAttribute()
- {
-
- return $this->hasMany("Program")->where('is_graduate', 1)->orderBy("name", 'asc');
- }
-
- //Esto envia
-
- /*
- [
- undergraduate_info:[
- outcomes_attempted_uncombined:{
- outcome_1: count(students),
-
- }
- outcomes_attempted_combined:{
-
- }
- outcomes_achieved_uncombined:{
-
- }
- outcomes_achieved_combined:{
-
- }
- ],
- graduate_info:[
-
- ]
- ]
-
- */
-
- public function getSchoolCoursesPerOutcomeAttribute()
- {
- $semesters = Semester::whereIn('id', Session::get('semesters_ids'))->get();
-
- $outcomes_grad = Outcome::active_by_semesters($semesters, 1);
- $outcomes_undergrad = Outcome::active_by_semesters($semesters, 0);
-
- $outcomes = Outcome::orderBy('name', 'asc')->get();
- $array_to_send = [];
-
-
-
- $undergraduate_students =
- DB::table('assessments')
- ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
- ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
- ->join('courses', 'courses.id', '=', 'activities.course_id')
- ->join('students', 'students.id', '=', 'assessments.student_id')
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
- ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
- ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
- ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
- ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
- ->whereIn('courses.program_id', $this->undergraduate_programs->lists('id'))
- ->whereIn('semester_id', Session::get('semesters_ids'))
- ->where('semesters.is_visible', '=', 1)
- ->select('student_id', 'courses.program_id', 'semesters.code', 'outcome_id', 'outcomes.expected_outcome', 'criterion_objective_outcome.criterion_id', 'score', 'expected_points')
- ->addSelect(DB::raw("count(activity_criterion.criterion_id) as criteria_attempted"))
- ->addSelect(DB::raw("count(CASE WHEN score>= expected_points then 1 else null END) as criteria_achieved"))
-
- ->groupBy('students.id', 'outcome_id');
-
- //->get();
-
-
-
- $undergraduate_students = $undergraduate_students->get();
-
- //$array_to_send["undergraduate_students"] = $undergraduate_students;
-
- $graduate_students = DB::table('assessments')
- ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
- ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
- ->join('courses', 'courses.id', '=', 'activities.course_id')
- ->join('students', 'students.id', '=', 'assessments.student_id')
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
- ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
- ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
- ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
- ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
- ->whereIn('courses.program_id', $this->graduate_programs->lists('id'))
- ->whereIn('semester_id', Session::get('semesters_ids'))
- ->where('semesters.is_visible', '=', 1)
- ->select('student_id', 'courses.program_id', 'semesters.code', 'outcome_id', 'outcomes.expected_outcome', 'criterion_objective_outcome.criterion_id', 'score', 'expected_points')
- ->addSelect(DB::raw("count(activity_criterion.criterion_id) as criteria_attempted"))
- ->addSelect(DB::raw("count(CASE WHEN score>= expected_points then 1 else null END) as criteria_achieved"))
-
- ->groupBy('students.id', 'outcome_id', 'courses.program_id')
- ->get();
-
- //$array_to_send["graduate_students"] = $graduate_students;
-
- //Log::info(count($graduate_students));
- //Log::info(count($undergraduate_students));
-
- $outcome_ids = DB::table("outcomes")
- ->whereNotNull('new_outcome_id')
- ->get();
-
- $combined_outcomes = [];
- foreach ($outcome_ids as $outcome) {
- $combined_outcomes[$outcome->id] = $outcome->new_outcome_id;
- }
-
- //Necesito undergraduateCombined, undergraduateUncombined,
- //lo mismo pa graduate
-
- $array_to_send['undergraduate_info'] = [];
- $array_to_send['graduate_info'] = [];
-
- $array_to_send['undergraduate_info']['outcomes_attempted_uncombined'] = [];
- $array_to_send['undergraduate_info']['outcomes_achieved_uncombined'] = [];
- $array_to_send['graduate_info']['outcomes_attempted_uncombined'] = [];
- $array_to_send['graduate_info']['outcomes_achieved_uncombined'] = [];
-
- $under_out_att = [];
- $under_out_ach = [];
- $program_out_att = [];
- $program_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $under_out_att[$outcome->id] = 0;
- $under_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
- //Para los programas attempted, voy a tener, un arreglo por dominio, y cada dominio tendra
- //indices por cada programa, y cada programa tendrá conteo del estudiantes que intentaron y
- // estudiantes que fallaron.
-
- //las filas son , estudiante, outcome que intentó, criterios_attempted, criterion_achieved,
- foreach ($undergraduate_students as $result) {
- $crit_att = $result->criteria_attempted;
- $crit_ach = $result->criteria_achieved;
- $expected_outcome = $result->expected_outcome;
-
- $program_id = $result->program_id;
-
- if (!isset($program_out_att[$result->outcome_id][$program_id])) {
- $program_out_att[$result->outcome_id][$program_id] = 0;
- }
-
- $program_out_att[$result->outcome_id][$program_id] += 1;
-
- $under_out_att[$result->outcome_id] += 1;
-
-
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$result->outcome_id][$program_id])) {
- $program_out_ach[$result->outcome_id][$program_id] = 0;
- }
- $program_out_ach[$result->outcome_id][$program_id] += 1;
- $under_out_ach[$result->outcome_id] += 1;
- }
- }
-
- $array_to_send['undergraduate_info']['programs_attempted_uncombined'] = $program_out_att;
- $array_to_send['undergraduate_info']['programs_achieved_uncombined'] = $program_out_ach;
-
- $array_to_send['undergraduate_info']['outcomes_attempted_uncombined'] = $under_out_att;
- $array_to_send['undergraduate_info']['outcomes_achieved_uncombined'] = $under_out_ach;
-
- $grad_out_att = [];
- $grad_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $grad_out_att[$outcome->id] = 0;
- $grad_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
-
- //las filas son , estudiante, outcome que intentó, criterios_attempted, criterion_achieved,
- foreach ($graduate_students as $result) {
- $crit_att = $result->criteria_attempted;
- $crit_ach = $result->criteria_achieved;
- $expected_outcome = $result->expected_outcome;
-
- $program_id = $result->program_id;
-
- if (!isset($program_out_att[$result->outcome_id][$program_id])) {
- $program_out_att[$result->outcome_id][$program_id] = 0;
- }
- $program_out_att[$result->outcome_id][$program_id] += 1;
-
-
- $grad_out_att[$result->outcome_id] += 1;
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$result->outcome_id][$program_id])) {
- $program_out_ach[$result->outcome_id][$program_id] = 0;
- }
- $program_out_ach[$result->outcome_id][$program_id] += 1;
- $grad_out_ach[$result->outcome_id] += 1;
- }
- }
-
- $array_to_send['graduate_info']['outcomes_attempted_uncombined'] = $grad_out_att;
- $array_to_send['graduate_info']['outcomes_achieved_uncombined'] = $grad_out_ach;
- $array_to_send['graduate_info']['programs_attempted_uncombined'] = $program_out_att;
- $array_to_send['graduate_info']['programs_achieved_uncombined'] = $program_out_ach;
-
-
-
-
- $array_to_send['undergraduate_info']['outcomes_attempted_combined'] = [];
- $array_to_send['undergraduate_info']['outcomes_achieved_combined'] = [];
- $array_to_send['graduate_info']['outcomes_attempted_combined'] = [];
- $array_to_send['graduate_info']['outcomes_achieved_combined'] = [];
-
- $under_out_att = [];
- $under_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $under_out_att[$outcome->id] = 0;
- $under_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
- //preprocess para combined_students
-
- $the_processed_table = [];
- foreach ($undergraduate_students as $result) {
- $student_id = $result->student_id;
- $outcome_id = $result->outcome_id;
- $expected_outcome = $result->expected_outcome;
- if (isset($combined_outcomes[$outcome_id]))
- $outcome_id = $combined_outcomes[$outcome_id];
-
-
-
- if (!isset($the_processed_table[$student_id])) {
- $the_processed_table[$student_id] = [];
- }
-
-
- //si en esta tabla, el estudiante no está pareado con este dominio, entonces registra
- // los criterios, achieved y attempted
- if (!isset($the_processed_table[$student_id][$outcome_id])) {
- $the_processed_table[$student_id][$outcome_id] = array(
- "criteria_attempted" => $result->criteria_attempted,
- "criteria_achieved" => $result->criteria_achieved,
- 'expected_outcome' => $expected_outcome,
- "program_id" => $result->program_id
- );
- }
- //si este estudiante está pareado a este dominio, significa que ahora estoy en los
- //deprecated outcomes.
- else {
- $the_processed_table[$student_id][$outcome_id]['criteria_attempted'] += $result->criteria_attempted;
- $the_processed_table[$student_id][$outcome_id]['criteria_achieved'] += $result->criteria_achieved;
- }
- }
-
-
- foreach ($the_processed_table as $student_id => $outcome_ids) {
- foreach ($outcome_ids as $outcome_id => $crit_information) {
- $crit_att = $crit_information['criteria_attempted'];
- $crit_ach = $crit_information['criteria_achieved'];
- $program_id = $crit_information['program_id'];
- $expected_outcome = $crit_information['expected_outcome'];
-
-
- $under_out_att[$outcome_id] += 1;
-
-
- if (!isset($program_out_att[$outcome_id][$program_id])) {
- $program_out_att[$outcome_id][$program_id] = 0;
- }
-
- $program_out_att[$outcome_id][$program_id] += 1;
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$outcome_id][$program_id])) {
- $program_out_ach[$outcome_id][$program_id] = 0;
- }
- $program_out_ach[$outcome_id][$program_id] += 1;
- $under_out_ach[$outcome_id] += 1;
- }
- }
- }
-
- $array_to_send['undergraduate_info']['outcomes_attempted_combined'] = $under_out_att;
- $array_to_send['undergraduate_info']['outcomes_achieved_combined'] = $under_out_ach;
- $array_to_send['undergraduate_info']['programs_attempted_combined'] = $program_out_att;
- $array_to_send['undergraduate_info']['programs_achieved_combined'] = $program_out_ach;
-
-
- $grad_out_att = [];
- $grad_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $grad_out_att[$outcome->id] = 0;
- $grad_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
- //preprocess para combined_students
-
- $the_processed_table = [];
- foreach ($graduate_students as $result) {
- $student_id = $result->student_id;
- $outcome_id = $result->outcome_id;
- $expected_outcome = $result->expected_outcome;
- if (isset($combined_outcomes[$outcome_id]))
- $outcome_id = $combined_outcomes[$outcome_id];
-
-
-
- if (!isset($the_processed_table[$student_id])) {
- $the_processed_table[$student_id] = [];
- }
-
-
- //si en esta tabla, el estudiante no está pareado con este dominio, entonces registra
- // los criterios, achieved y attempted
- if (!isset($the_processed_table[$student_id][$outcome_id])) {
- $the_processed_table[$student_id][$outcome_id] = array(
- "criteria_attempted" => $result->criteria_attempted,
- "criteria_achieved" => $result->criteria_achieved,
- 'expected_outcome' => $expected_outcome,
- 'program_id' => $result->program_id
- );
- }
- //si este estudiante está pareado a este dominio, significa que ahora estoy en los
- //deprecated outcomes.
- else {
- $the_processed_table[$student_id][$outcome_id]['criteria_attempted'] += $result->criteria_attempted;
- $the_processed_table[$student_id][$outcome_id]['criteria_achieved'] += $result->criteria_achieved;
- }
- }
-
-
-
-
- foreach ($the_processed_table as $student_id => $outcome_ids) {
- foreach ($outcome_ids as $out_id => $crit_information) {
- $crit_att = $crit_information['criteria_attempted'];
- $crit_ach = $crit_information['criteria_achieved'];
- $program_id = $crit_information['program_id'];
- $expected_outcome = $crit_information['expected_outcome'];
-
-
- $grad_out_att[$out_id] += 1;
-
- if (!isset($program_out_att[$out_id][$program_id])) {
- $program_out_att[$out_id][$program_id] = 0;
- }
-
- $program_out_att[$out_id][$program_id] += 1;
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$out_id][$program_id])) {
- $program_out_ach[$out_id][$program_id] = 0;
- }
- $program_out_ach[$out_id][$program_id] += 1;
- $grad_out_ach[$out_id] += 1;
- }
- }
- }
-
- $array_to_send['graduate_info']['outcomes_attempted_combined'] = $grad_out_att;
- $array_to_send['graduate_info']['outcomes_achieved_combined'] = $grad_out_ach;
- $array_to_send['graduate_info']['programs_attempted_combined'] = $program_out_att;
- $array_to_send['graduate_info']['programs_achieved_combined'] = $program_out_ach;
-
- Log::info($array_to_send);
- return $array_to_send;
- }
-
-
- public function getSchoolStudentsPerOutcomeAttribute()
- {
-
- $semesters = Semester::whereIn('id', Session::get('semesters_ids'))->get();
-
- $outcomes_grad = Outcome::active_by_semesters($semesters, 1);
- $outcomes_undergrad = Outcome::active_by_semesters($semesters, 0);
-
- $outcomes = Outcome::orderBy('name', 'asc')->get();
- $array_to_send = [];
-
-
-
- $undergraduate_students =
- DB::table('assessments')
- ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
- ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
- ->join('courses', 'courses.id', '=', 'activities.course_id')
- ->join('students', 'students.id', '=', 'assessments.student_id')
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
- ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
- ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
- ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
- ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
- ->whereIn('students.program_id', $this->undergraduate_programs->lists('id'))
- ->whereIn('semester_id', Session::get('semesters_ids'))
- ->where('semesters.is_visible', '=', 1)
- ->select('student_id', 'students.program_id', 'semesters.code', 'outcome_id', 'outcomes.expected_outcome', 'criterion_objective_outcome.criterion_id', 'score', 'expected_points')
- ->addSelect(DB::raw("count(activity_criterion.criterion_id) as criteria_attempted"))
- ->addSelect(DB::raw("count(CASE WHEN score>= expected_points then 1 else null END) as criteria_achieved"))
-
- ->groupBy('students.id', 'outcome_id');
-
- //->get();
-
-
-
- $undergraduate_students = $undergraduate_students->get();
-
- //$array_to_send["undergraduate_students"] = $undergraduate_students;
-
- $graduate_students = DB::table('assessments')
- ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
- ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
- ->join('courses', 'courses.id', '=', 'activities.course_id')
- ->join('students', 'students.id', '=', 'assessments.student_id')
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
- ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
- ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
- ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
- ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
- ->whereIn('students.program_id', $this->graduate_programs->lists('id'))
- ->whereIn('semester_id', Session::get('semesters_ids'))
- ->where('semesters.is_visible', '=', 1)
- ->select('student_id', 'students.program_id', 'semesters.code', 'outcome_id', 'outcomes.expected_outcome', 'criterion_objective_outcome.criterion_id', 'score', 'expected_points')
- ->addSelect(DB::raw("count(activity_criterion.criterion_id) as criteria_attempted"))
- ->addSelect(DB::raw("count(CASE WHEN score>= expected_points then 1 else null END) as criteria_achieved"))
-
- ->groupBy('students.id', 'outcome_id')
- ->get();
-
- //$array_to_send["graduate_students"] = $graduate_students;
-
- //Log::info(count($graduate_students));
- //Log::info(count($undergraduate_students));
-
- $outcome_ids = DB::table("outcomes")
- ->whereNotNull('new_outcome_id')
- ->get();
-
- $combined_outcomes = [];
- foreach ($outcome_ids as $outcome) {
- $combined_outcomes[$outcome->id] = $outcome->new_outcome_id;
- }
-
- //Necesito undergraduateCombined, undergraduateUncombined,
- //lo mismo pa graduate
-
- $array_to_send['undergraduate_info'] = [];
- $array_to_send['graduate_info'] = [];
-
- $array_to_send['undergraduate_info']['outcomes_attempted_uncombined'] = [];
- $array_to_send['undergraduate_info']['outcomes_achieved_uncombined'] = [];
- $array_to_send['graduate_info']['outcomes_attempted_uncombined'] = [];
- $array_to_send['graduate_info']['outcomes_achieved_uncombined'] = [];
-
- $under_out_att = [];
- $under_out_ach = [];
- $program_out_att = [];
- $program_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $under_out_att[$outcome->id] = 0;
- $under_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
- //Para los programas attempted, voy a tener, un arreglo por dominio, y cada dominio tendra
- //indices por cada programa, y cada programa tendrá conteo del estudiantes que intentaron y
- // estudiantes que fallaron.
-
- //las filas son , estudiante, outcome que intentó, criterios_attempted, criterion_achieved,
- foreach ($undergraduate_students as $result) {
- $crit_att = $result->criteria_attempted;
- $crit_ach = $result->criteria_achieved;
- $expected_outcome = $result->expected_outcome;
-
-
- $program_id = $result->program_id;
-
- if (!isset($program_out_att[$result->outcome_id][$program_id])) {
- $program_out_att[$result->outcome_id][$program_id] = 0;
- }
-
- $program_out_att[$result->outcome_id][$program_id] += 1;
-
- $under_out_att[$result->outcome_id] += 1;
-
-
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$result->outcome_id][$program_id])) {
- $program_out_ach[$result->outcome_id][$program_id] = 0;
- }
- $program_out_ach[$result->outcome_id][$program_id] += 1;
- $under_out_ach[$result->outcome_id] += 1;
- }
- }
-
- $array_to_send['undergraduate_info']['programs_attempted_uncombined'] = $program_out_att;
- $array_to_send['undergraduate_info']['programs_achieved_uncombined'] = $program_out_ach;
-
- $array_to_send['undergraduate_info']['outcomes_attempted_uncombined'] = $under_out_att;
- $array_to_send['undergraduate_info']['outcomes_achieved_uncombined'] = $under_out_ach;
-
- $grad_out_att = [];
- $grad_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $grad_out_att[$outcome->id] = 0;
- $grad_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
-
- //las filas son , estudiante, outcome que intentó, criterios_attempted, criterion_achieved,
- foreach ($graduate_students as $result) {
- $crit_att = $result->criteria_attempted;
- $crit_ach = $result->criteria_achieved;
- $expected_outcome = $result->expected_outcome;
-
- $program_id = $result->program_id;
-
- if (!isset($program_out_att[$result->outcome_id][$program_id])) {
- $program_out_att[$result->outcome_id][$program_id] = 0;
- }
- $program_out_att[$result->outcome_id][$program_id] += 1;
-
-
- $grad_out_att[$result->outcome_id] += 1;
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$result->outcome_id][$program_id])) {
- $program_out_ach[$result->outcome_id][$program_id] = 0;
- }
- $program_out_ach[$result->outcome_id][$program_id] += 1;
- $grad_out_ach[$result->outcome_id] += 1;
- }
- }
-
- $array_to_send['graduate_info']['outcomes_attempted_uncombined'] = $grad_out_att;
- $array_to_send['graduate_info']['outcomes_achieved_uncombined'] = $grad_out_ach;
- $array_to_send['graduate_info']['programs_attempted_uncombined'] = $program_out_att;
- $array_to_send['graduate_info']['programs_achieved_uncombined'] = $program_out_ach;
-
-
-
-
- $array_to_send['undergraduate_info']['outcomes_attempted_combined'] = [];
- $array_to_send['undergraduate_info']['outcomes_achieved_combined'] = [];
- $array_to_send['graduate_info']['outcomes_attempted_combined'] = [];
- $array_to_send['graduate_info']['outcomes_achieved_combined'] = [];
-
- $under_out_att = [];
- $under_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $under_out_att[$outcome->id] = 0;
- $under_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
- //preprocess para combined_students
-
- $the_processed_table = [];
- foreach ($undergraduate_students as $result) {
- $student_id = $result->student_id;
- $outcome_id = $result->outcome_id;
- $expected_outcome = $result->expected_outcome;
- if (isset($combined_outcomes[$outcome_id]))
- $outcome_id = $combined_outcomes[$outcome_id];
-
-
-
- if (!isset($the_processed_table[$student_id])) {
- $the_processed_table[$student_id] = [];
- }
-
-
- //si en esta tabla, el estudiante no está pareado con este dominio, entonces registra
- // los criterios, achieved y attempted
- if (!isset($the_processed_table[$student_id][$outcome_id])) {
- $the_processed_table[$student_id][$outcome_id] = array(
- "criteria_attempted" => $result->criteria_attempted,
- "criteria_achieved" => $result->criteria_achieved,
- "program_id" => $result->program_id,
- 'expected_outcome' => $expected_outcome
- );
- }
- //si este estudiante está pareado a este dominio, significa que ahora estoy en los
- //deprecated outcomes.
- else {
- $the_processed_table[$student_id][$outcome_id]['criteria_attempted'] += $result->criteria_attempted;
- $the_processed_table[$student_id][$outcome_id]['criteria_achieved'] += $result->criteria_achieved;
- }
- }
-
-
- foreach ($the_processed_table as $student_id => $outcome_ids) {
- foreach ($outcome_ids as $outcome_id => $crit_information) {
- $crit_att = $crit_information['criteria_attempted'];
- $crit_ach = $crit_information['criteria_achieved'];
- $program_id = $crit_information['program_id'];
- $expected_outcome = $crit_information['expected_outcome'];
-
-
- $under_out_att[$outcome_id] += 1;
-
-
- if (!isset($program_out_att[$outcome_id][$program_id])) {
- $program_out_att[$outcome_id][$program_id] = 0;
- }
-
- $program_out_att[$outcome_id][$program_id] += 1;
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$outcome_id][$program_id])) {
- $program_out_ach[$outcome_id][$program_id] = 0;
- }
- $program_out_ach[$outcome_id][$program_id] += 1;
- $under_out_ach[$outcome_id] += 1;
- }
- }
- }
-
- $array_to_send['undergraduate_info']['outcomes_attempted_combined'] = $under_out_att;
- $array_to_send['undergraduate_info']['outcomes_achieved_combined'] = $under_out_ach;
- $array_to_send['undergraduate_info']['programs_attempted_combined'] = $program_out_att;
- $array_to_send['undergraduate_info']['programs_achieved_combined'] = $program_out_ach;
-
-
- $grad_out_att = [];
- $grad_out_ach = [];
-
- foreach ($outcomes as $outcome) {
- $grad_out_att[$outcome->id] = 0;
- $grad_out_ach[$outcome->id] = 0;
- $program_out_att[$outcome->id] = [];
- $program_out_ach[$outcome->id] = [];
- }
-
- //preprocess para combined_students
-
- $the_processed_table = [];
- foreach ($graduate_students as $result) {
- $student_id = $result->student_id;
- $outcome_id = $result->outcome_id;
- $expected_outcome = $result->expected_outcome;
- if (isset($combined_outcomes[$outcome_id]))
- $outcome_id = $combined_outcomes[$outcome_id];
-
-
-
- if (!isset($the_processed_table[$student_id])) {
- $the_processed_table[$student_id] = [];
- }
-
-
- //si en esta tabla, el estudiante no está pareado con este dominio, entonces registra
- // los criterios, achieved y attempted
- if (!isset($the_processed_table[$student_id][$outcome_id])) {
- $the_processed_table[$student_id][$outcome_id] = array(
- "criteria_attempted" => $result->criteria_attempted,
- "criteria_achieved" => $result->criteria_achieved,
- 'program_id' => $result->program_id,
- 'expected_outcome' => $expected_outcome
- );
- }
- //si este estudiante está pareado a este dominio, significa que ahora estoy en los
- //deprecated outcomes.
- else {
- $the_processed_table[$student_id][$outcome_id]['criteria_attempted'] += $result->criteria_attempted;
- $the_processed_table[$student_id][$outcome_id]['criteria_achieved'] += $result->criteria_achieved;
- }
- }
-
-
-
-
- foreach ($the_processed_table as $student_id => $outcome_ids) {
- foreach ($outcome_ids as $out_id => $crit_information) {
- $crit_att = $crit_information['criteria_attempted'];
- $crit_ach = $crit_information['criteria_achieved'];
- $program_id = $crit_information['program_id'];
- $expected_outcome = $crit_information['expected_outcome'];
- $grad_out_att[$out_id] += 1;
-
- if (!isset($program_out_att[$out_id][$program_id])) {
- $program_out_att[$out_id][$program_id] = 0;
- }
-
- $program_out_att[$out_id][$program_id] += 1;
-
- if ($crit_att != 0 && ($crit_ach / $crit_att) * 100 >= $expected_outcome) {
- if (!isset($program_out_ach[$out_id][$program_id])) {
- $program_out_ach[$out_id][$program_id] = 0;
- }
- $program_out_ach[$out_id][$program_id] += 1;
- $grad_out_ach[$out_id] += 1;
- }
- }
- }
-
- $array_to_send['graduate_info']['outcomes_attempted_combined'] = $grad_out_att;
- $array_to_send['graduate_info']['outcomes_achieved_combined'] = $grad_out_ach;
- $array_to_send['graduate_info']['programs_attempted_combined'] = $program_out_att;
- $array_to_send['graduate_info']['programs_achieved_combined'] = $program_out_ach;
-
- Log::info($array_to_send);
- return $array_to_send;
- }
- }
|