Browse Source

resuelve bugs en Annual plans, actividades y criteria

parent
commit
3e01d3e535

+ 1
- 1
app/controllers/ActivitiesController.php View File

@@ -172,7 +172,7 @@ class ActivitiesController extends \BaseController
172 172
         //}
173 173
 
174 174
         //Log::info($outcomes_achieved);
175
-        //Log::info($outcomes_achieved);
175
+//         Log::info(json_encode($activity));
176 176
 
177 177
         $outcomes_activity = $activity->getOutcomeReport();
178 178
 

+ 41
- 36
app/controllers/AnnualPlansController.php View File

@@ -222,7 +222,7 @@ class AnnualPlansController extends \BaseController
222 222
     // Log::info($annual_plans);
223 223
     $outcomes = array();
224 224
     $allSemesterOrder = array();
225
-    Log::info($annual_plans);
225
+//     Log::info($annual_plans);
226 226
     /*foreach ($annual_plans as $an_plan) {
227 227
       Log::info($an_plan->id);
228 228
       $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ->id} ))");
@@ -238,7 +238,7 @@ class AnnualPlansController extends \BaseController
238 238
 
239 239
   public function fetchInfo()
240 240
   {
241
-    Log::info(Input::get('id'));
241
+//     Log::info(Input::get('id'));
242 242
     $an_plan = DB::table("annual_plans")
243 243
       ->join('annual_cycle', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
244 244
       ->where('annual_plans.id', '=', Input::get('id'))
@@ -257,8 +257,8 @@ class AnnualPlansController extends \BaseController
257 257
       })
258 258
       ->select('typ_program.*')
259 259
       ->first();
260
-    Log::info(array($an_plan));
261
-    Log::info(array($current_typ_program));
260
+//     Log::info(array($an_plan));
261
+//     Log::info(array($current_typ_program));
262 262
 
263 263
     //DB::select("select * from typ_program where program_id = {$an_plan->program_id} and three_year_plan_id in (select id from three_year_plan where year_start <= {$years[0]} and year_end>= {$years[1]})")[0];
264 264
 
@@ -354,13 +354,13 @@ class AnnualPlansController extends \BaseController
354 354
       $typ_info['courses'][$objective->id] = DB::select("select c.id, c.number, c.name, c.code, typ.id typ_course_id from courses c, typ_semester_courses typ, (select course_id, id  from typ_semester_courses where typ_semester_objective_id in (select id from typ_semester_objectives where objective_id ={$objective->id} and typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id =? and semester_id ={$semester->id} and typ_program_id in(select id from typ_program where program_id ={$program_id})))) rel where typ.course_id =c.id and rel.course_id = c.id and typ.id = rel.id ", array(Input::get('id')));
355 355
 
356 356
       $typ_info['criteria'][$objective->id] = DB::select("select * from criteria where deleted_at IS NULL and id in (select criterion_id from criterion_objective_outcome join program_criterion_objective_outcome on program_criterion_objective_outcome.cri_obj_out_id = criterion_objective_outcome.id where outcome_id = ? and program_id  = {$program_id} and objective_id = {$objective->id})", array(Input::get('id')));
357
-      Log::info($typ_info['criteria'][$objective->id]);
357
+//       Log::info($typ_info['criteria'][$objective->id]);
358 358
       $typ_info['typ_objective_id'][$objective->id] = DB::select("select id from typ_semester_objectives where objective_id = {$objective->id} and typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id =? and semester_id ={$semester->id} and typ_program_id in (select id from typ_program where program_id ={$program_id}))", array(Input::get('id')));
359
-      Log::info($typ_info['typ_objective_id'][$objective->id]);
359
+//       Log::info($typ_info['typ_objective_id'][$objective->id]);
360 360
       $typ_info['typ_objective_id'][$objective->id] = $typ_info['typ_objective_id'][$objective->id][0];
361 361
 
362
-      Log::info($typ_info['typ_objective_id'][$objective->id]->id);
363
-      Log::info($annual_plan->id);
362
+//       Log::info($typ_info['typ_objective_id'][$objective->id]->id);
363
+//       Log::info($annual_plan->id);
364 364
       //  $typ_info['annual_plans_transformative'][$objective->id] = DB::select(
365 365
       //    "select trans_id from annual_plan_transformative
366 366
       //     where annual_plan_id={$annual_plan->id} 
@@ -386,7 +386,7 @@ class AnnualPlansController extends \BaseController
386 386
       }
387 387
     }
388 388
     $typ_info['annual_plan'] = $annual_plan;
389
-    Log::info($typ_info);
389
+//     Log::info($typ_info);
390 390
 
391 391
     $typ_info['transformative_actions_for_outcome'] = DB::table('transformative_actions')
392 392
       ->join('transformative_typ_outcome', 'transformative_typ_outcome.trans_id', '=', 'transformative_actions.id')
@@ -533,8 +533,8 @@ class AnnualPlansController extends \BaseController
533 533
     foreach ($annual_plan['first']['outcomes'] as $outcomes) {
534 534
 
535 535
       $annual_plan['first']['objectives'][$outcomes->id] = DB::select("select * from objectives where id in (select objective_id from typ_semester_objectives where typ_semester_outcome_id in(select id from typ_semester_outcome where outcome_id = {$outcomes->id} and semester_id = {$an_semesters->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_semesters->program_id})))");
536
-      Log::info($outcomes->id);
537
-      Log::info($annual_plan['first']['objectives'][$outcomes->id]);
536
+      //Log::info($outcomes->id);
537
+//       Log::info($annual_plan['first']['objectives'][$outcomes->id]);
538 538
       foreach ($annual_plan['first']['objectives'][$outcomes->id] as $objective) {
539 539
         $annual_plan['first']['typ_objective_id'][$objective->id] = DB::select("select id from typ_semester_objectives where objective_id = {$objective->id} and  typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id ={$outcomes->id} and semester_id ={$an_semesters->semester_start} and typ_program_id in(select id from typ_program where program_id ={$an_semesters->program_id})) ")[0];
540 540
         $annual_plan['first']['courses'][$objective->id] = DB::select("select typ.id typ_course_id, typ.course_id, c.code, c.number, c.name from (select course_id, id from typ_semester_courses where typ_semester_objective_id = {$annual_plan['first']['typ_objective_id'][$objective->id]->id}) typ, courses c where c.id = typ.course_id");
@@ -543,7 +543,7 @@ class AnnualPlansController extends \BaseController
543 543
           $annual_plan['first']['trans_actions'][$objective->id][$course->typ_course_id] = DB::select("select * from transformative_actions where id in (select trans_id from annual_plan_transformative where typ_semester_course_id = {$course->typ_course_id})");
544 544
         }
545 545
 
546
-        Log::info($objective->id);
546
+//         Log::info($objective->id);
547 547
         /*$annual_plan['first']['trans_actions'][$objective->id] = DB::select("select * from transformative_actions where id in (select trans_id from annual_plan_transformative where typ_semester_objective_id ={$annual_plan['first']['typ_objective_id'][$objective->id]->id})");
548 548
         foreach ($annual_plan['first']['trans_actions'][$objective->id] as $trans) {
549 549
           Log::info($annual_plan['first']['typ_objective_id'][$objective->id]->id);
@@ -658,7 +658,7 @@ class AnnualPlansController extends \BaseController
658 658
       ->select('courses.code', 'courses.number')
659 659
       ->distinct()
660 660
       ->get();
661
-    Log::info($course_codes);
661
+//     Log::info($course_codes);
662 662
     $all_courses_info = [];
663 663
 
664 664
     foreach ($course_codes as $index => $course_code) {
@@ -671,8 +671,8 @@ class AnnualPlansController extends \BaseController
671 671
         ->where('number', $course_code->number)
672 672
         ->where('program_id', $program_id)
673 673
         ->get();
674
-      Log::info("run number " . $index);
675
-      Log::info($courses);
674
+      //Log::info("run number " . $index);
675
+//       Log::info($courses);
676 676
       foreach ($courses as $course) {
677 677
         $all_courses_info[$course_code->code . '_' . $course_code->number][] = $course->getReportObject();
678 678
       }
@@ -751,7 +751,7 @@ class AnnualPlansController extends \BaseController
751 751
     $outcome->semester_info = DB::table('semesters')
752 752
       ->where('id', $semester_id)
753 753
       ->first();
754
-    Log::info($typ_semester_outcome_id);
754
+//     Log::info($typ_semester_outcome_id);
755 755
     $outcome->comments = $outcome->getCommentsAttribute();
756 756
     // $outcome->comments = "COMMENT";
757 757
     //Log::info("Comments");
@@ -765,8 +765,8 @@ class AnnualPlansController extends \BaseController
765 765
 
766 766
 
767 767
     foreach ($outcome->objectives as $index => $objective) {
768
-      Log::info("Ella son besties");
769
-      Log::info(array($objective));
768
+//       Log::info("Ella son besties");
769
+//       Log::info(array($objective));
770 770
       $objective->courses = Objective::getPlanReport($objective);
771 771
     }
772 772
 
@@ -976,7 +976,7 @@ class AnnualPlansController extends \BaseController
976 976
     $typ_semester_outcome_id = Input::get('typ_outcome_semester_id');
977 977
     $comments = Input::get('comments');
978 978
 
979
-    Log::info(Input::all());
979
+//     Log::info(Input::all());
980 980
 
981 981
     if ($edit_id) {
982 982
       DB::table('typ_outcome_report_comments')
@@ -1021,8 +1021,8 @@ class AnnualPlansController extends \BaseController
1021 1021
     $pdf->save(app_path() . '/storage/annual_pdfs/' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf');
1022 1022
     return $pdf->download(date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf');
1023 1023
     */ //pdf = $pdf->setOrientation("landscape");
1024
-    Log::info("submit");
1025
-    Log::info($submit);
1024
+//     Log::info("submit");
1025
+//     Log::info($submit);
1026 1026
     return View::make('local.managers.shared.print_annual_report', compact('annualPlan', 'submit'));
1027 1027
   }
1028 1028
 
@@ -1037,7 +1037,7 @@ class AnnualPlansController extends \BaseController
1037 1037
     //  ->setOrientation("landscape")
1038 1038
 
1039 1039
     //  ->setPaper('legal', 'landscape');
1040
-    $path = app_path() . '/views/annual_htmls/report-on-' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '-by-' . $user_id . '.blade.php';
1040
+    $path = app_path() . '/views/annual_htmls/report-on-' . date('d-m-Y') .'ac'.$annualPlan->annual_cycle_id . '-for-' . $annualPlan->program->id . '-by-' . $user_id . '.blade.php';
1041 1041
     //$pdf->save($path);
1042 1042
     //$name = date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
1043 1043
     //$pdf->download($name);
@@ -1120,8 +1120,8 @@ class AnnualPlansController extends \BaseController
1120 1120
     $path = DB::table('paths_for_annual_plans')->where('id', $path_id)->first();
1121 1121
 
1122 1122
     if (isset($path)) {
1123
-      Log::info($path->path_to_pdf);
1124
-      Log::info(app_path()); //. "/views/annual_htmls/");
1123
+//       Log::info($path->path_to_pdf);
1124
+//       Log::info(app_path()); //. "/views/annual_htmls/");
1125 1125
 
1126 1126
 
1127 1127
       //FALTA COMO HACER PAl REPORT.
@@ -1141,9 +1141,6 @@ class AnnualPlansController extends \BaseController
1141 1141
       $path = str_replace(app_path() . '/views/annual_htmls/', '', $path->path_to_pdf);
1142 1142
 
1143 1143
 
1144
-
1145
-
1146
-
1147 1144
       $path = trim($path, ".blade.php");
1148 1145
       $dir =  '';
1149 1146
 
@@ -1218,7 +1215,7 @@ class AnnualPlansController extends \BaseController
1218 1215
   public function checkIfPlanReady()
1219 1216
   {
1220 1217
     $annual_plan = AnnualPlan::findOrFail(Input::get("annual_id"));
1221
-    Log::info('annual_plan' . $annual_plan->courses);
1218
+//     Log::info('annual_plan' . $annual_plan->courses);
1222 1219
 
1223 1220
     /*
1224 1221
       error = [
@@ -1229,14 +1226,14 @@ class AnnualPlansController extends \BaseController
1229 1226
     */
1230 1227
     $error_array = [];
1231 1228
 
1232
-    Log::info("Esto devuelve?");
1229
+//     Log::info("Esto devuelve?");
1233 1230
 
1234
-    Log::info($annual_plan->courses);
1231
+//     Log::info($annual_plan->courses);
1235 1232
 
1236 1233
     foreach ($annual_plan->courses as $index => $course) {
1237 1234
 
1238
-      Log::info('paired Criteria');
1239
-      Log::info($course->paired_criteria);
1235
+//       Log::info('paired Criteria');
1236
+//       Log::info($course->paired_criteria);
1240 1237
       if (count($course->paired_criteria) <= 0) {
1241 1238
         $outcome = $course->paired_objective->paired_outcome;
1242 1239
         $objective = $course->paired_objective;
@@ -1283,7 +1280,7 @@ class AnnualPlansController extends \BaseController
1283 1280
       'courses' => [],
1284 1281
       'outcomes' => []
1285 1282
     ];
1286
-    Log::info($annual_plan->courses_with_transformative_actions);
1283
+//     Log::info($annual_plan->courses_with_transformative_actions);
1287 1284
     foreach ($annual_plan->courses_with_transformative_actions as $course) {
1288 1285
 
1289 1286
       foreach ($course->proposed_transformative_actions as $ta) {
@@ -1331,6 +1328,12 @@ class AnnualPlansController extends \BaseController
1331 1328
   {
1332 1329
     $alphabet = range("A", "Z");
1333 1330
     $annualPlan = AnnualPlan::findOrFail($annual_id);
1331
+        Log::info(json_encode($annualPlan));
1332
+	$temp=$annualPlan->getCoursesAttribute();
1333
+	        Log::info("cursos plan");
1334
+	        Log::info(json_encode($temp));
1335
+	        Log::info("termina cursos plan");
1336
+
1334 1337
     $small_alphabet = range('a', 'z');
1335 1338
     return View::make('local.managers.shared.print_annual_plan', compact('annualPlan', 'alphabet', 'small_alphabet', 'submit'));
1336 1339
   }
@@ -1340,15 +1343,17 @@ class AnnualPlansController extends \BaseController
1340 1343
     $alphabet = range("A", "Z");
1341 1344
     $small_alphabet = range('a', 'z');
1342 1345
     $annualPlan = AnnualPlan::findOrFail($annual_id);
1346
+//     Log::info(json_encode($annualPlan));
1347
+// Log::info($annualPlan->annual_cycle_id);
1343 1348
     $user_id = Auth::user()->id;
1344 1349
     //$pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
1345 1350
     //$pdf = $pdf->loadView('local.managers.shared.print_annual_plan', compact('annualPlan', 'alphabet', 'small_alphabet'))
1346 1351
     //  ->setOrientation("landscape")
1347 1352
 
1348 1353
     //  ->setPaper('legal', 'landscape');
1349
-    $path = app_path() . '/views/annual_htmls/plan-on-' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '-by-' . $user_id . '.blade.php';
1354
+    $path = app_path() . '/views/annual_htmls/plan-on-' . date('d-m-Y') .'ac'.$annualPlan->annual_cycle_id . '-for-' . $annualPlan->program->id . '-by-' . $user_id . '.blade.php';
1350 1355
     //$pdf->save($path);
1351
-    $name = "plan-on-" . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.blade.php';
1356
+    $name = "plan-on-" . date('d-m-Y') .'ac'.$annualPlan->annual_cycle_id .'-for-' . $annualPlan->program->id . '.blade.php';
1352 1357
     //$pdf->download($name);
1353 1358
 
1354 1359
     //is a path already there
@@ -1356,7 +1361,7 @@ class AnnualPlansController extends \BaseController
1356 1361
     $it_exists = DB::table("paths_for_annual_plans")
1357 1362
       ->where('path_to_pdf', $path)
1358 1363
       ->first();
1359
-
1364
+// Log::info(
1360 1365
     if (isset($it_exists)) {
1361 1366
       return '200';
1362 1367
     }

+ 4
- 3
app/controllers/CriteriaController.php View File

@@ -95,7 +95,7 @@ class CriteriaController extends \BaseController
95 95
         $program_id = Input::get('program_fetch');
96 96
         $outcome_id = Input::get('outcome_fetch');
97 97
         $json = array();
98
-        $json['criterion'] = DB::select("SELECT * FROM `criteria` where id in (select criterion_id from criterion_objective_outcome join program_criterion_objective_outcome on program_criterion_objective_outcome.cri_obj_out = criterion_objective_outcome.id where outcome_id ={$outcome_id} and program_id = {$program_id}) ");
98
+        $json['criterion'] = DB::select("SELECT * FROM `criteria` where id in (select criterion_id from criterion_objective_outcome join program_criterion_objective_outcome on program_criterion_objective_outcome.cri_obj_out_id = criterion_objective_outcome.id where outcome_id ={$outcome_id} and program_id = {$program_id}) ");
99 99
 
100 100
         return json_encode($json);
101 101
     }
@@ -461,8 +461,9 @@ class CriteriaController extends \BaseController
461 461
      */
462 462
     public function create()
463 463
     {
464
-        $clean_input = $this->cleanInput();
464
+        $clean_input = $this->cleanInput();	
465 465
 
466
+        Log::info(json_encode($clean_input));
466 467
 
467 468
         /** Validation rules */
468 469
         $validator = $this->makeValidator($clean_input);
@@ -488,7 +489,7 @@ class CriteriaController extends \BaseController
488 489
                     return Redirect::to('criteria')->withInput();
489 490
 
490 491
                 case 2:
491
-                    Log::info(Input::all());
492
+//                     Log::info(Input::all());
492 493
                     return Redirect::to('school-criteria')->withInput();
493 494
 
494 495
                 case 3:

+ 6
- 14
app/models/Activity.php View File

@@ -154,7 +154,9 @@ class Activity extends Eloquent
154 154
       ->select('outcomes.*')
155 155
       ->distinct()
156 156
       ->get();
157
-    $rubric = $this->rubric[0];
157
+    Log::info(json_encode($this));
158
+
159
+    if(isset($this->rubric[0]))$rubric = $this->rubric[0]; else $rubric=new stdClass();
158 160
     $outcomes_dict = [];
159 161
     foreach ($outcomes as $outcome) {
160 162
       $outcomes_dict[$outcome->id] = $outcome;
@@ -257,20 +259,10 @@ class Activity extends Eloquent
257 259
           $conteo_outcome_achieved++;
258 260
         }
259 261
       }
260
-      $outcome->achieved = $conteo_outcome_achieved;
261
-      $outcome->percentage = round(($outcome->achieved / $outcome->attempted * 100), 2);
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
262
+    Log::info(json_encode($outcome));
273 263
 
264
+      $outcome->achieved = $conteo_outcome_achieved;
265
+      if(isset($outcome->attempted) and $outcome->attempted!=0)$outcome->percentage = round(($outcome->achieved / $outcome->attempted * 100), 2);
274 266
 
275 267
       /*foreach ($students_attempted as $student) {
276 268
         $student_criteria[$student];

+ 3
- 5
app/views/local/managers/shared/criteria.blade.php View File

@@ -67,15 +67,14 @@
67 67
 
68 68
                     <!-- Associated Program -->
69 69
                     <div class="form-group form_validation program_form" id='program-checkboxes'>
70
-                        {{ Form::label('program_id', 'Associated Program') }}<br>
70
+                        {{ Form::label('program_id', 'Associated Program2') }}<br>
71 71
                         <br>
72 72
                         @if (count($programs) == 1)
73 73
                             <input type="checkbox" id="program-{{ $programs[0]->name }}" name="program_id[]"
74 74
                                 value="{{ $programs[0]->id }}" checked>
75 75
                             <label for="program-{{ $programs[0]->name }}"> {{ $programs[0]->name }}
76 76
                                 [{{ $programs[0]->school->name }}]</label><br>
77
-                            <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]"
78
-                                value="{{ $programs[0]->id }}">
77
+<!--                             <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]" value="{{ $programs[0]->id }}"> -->
79 78
                         @else
80 79
                             @foreach ($programs as $program)
81 80
                                 <input type="checkbox" id="program-{{ $program->id }}" name="program_id[]"
@@ -219,8 +218,7 @@
219 218
 
220 219
                         @if (count($programs) == 1)
221 220
 
222
-                            <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]"
223
-                                value="{{ $programs[0]->id }}">
221
+<!--                             <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]" value="{{ $programs[0]->id }}"> -->
224 222
 
225 223
                             <input type="checkbox" id="assoc_program-{{ $programs[0]->id }}" name="program_id[]"
226 224
                                 value="{{ $programs[0]->id }}" checked>

+ 1
- 1
app/views/local/managers/shared/print_annual_plan.blade.php View File

@@ -300,7 +300,7 @@ window.close();
300 300
 </script>
301 301
 <?php 
302 302
 
303
-  $path = app_path() . '/views/annual_htmls/plan-on-' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '-by-' . Auth::user()->id . '.blade.php';
303
+  $path = app_path() . '/views/annual_htmls/plan-on-' . date('d-m-Y') .'ac'.$annualPlan->annual_cycle_id . '-for-' . $annualPlan->program->id . '-by-' . Auth::user()->id . '.blade.php';
304 304
   $ob = ob_get_contents();
305 305
   $ob = str_replace("window.close();", '', $ob);
306 306
   file_put_contents($path, $ob);

+ 1
- 1
app/views/local/professors/activity.blade.php View File

@@ -611,7 +611,7 @@
611 611
     data:[
612 612
     @foreach ($outcomes as $index => $outcome)
613 613
         @if( array_key_exists($outcome->id, $outcomes_activity) &&
614
-        $outcomes_activity[$outcome->id])
614
+        $outcomes_activity[$outcome->id] && $outcomes_activity[$outcome->id]->attempted!=0)
615 615
             {{$outcomes_activity[$outcome->id]->achieved / $outcomes_activity[$outcome->id]->attempted * 100}}
616 616
             {{-- ($outcomes_achieved[$outcome->id] / $outcomes_attempted[$outcome->id]) * 100 --}},
617 617
         {{--@if (is_array($outcomes_attempted) && array_key_exists($outcome->id, $outcomes_attempted) && $outcomes_attempted[$outcome->id] != 0) --}}