Browse Source

Update ThreeYearPlanController.php

Fixes  to queries
onielm 3 years ago
parent
commit
88f674311c
1 changed files with 8 additions and 16 deletions
  1. 8
    16
      app/controllers/ThreeYearPlanController.php

+ 8
- 16
app/controllers/ThreeYearPlanController.php View File

329
           }
329
           }
330
 
330
 
331
           // lookup available objectives
331
           // lookup available objectives
332
-          $result_objectives = DB::table('criterion_objective_outcome')
333
-              ->join('outcomes','outcomes.id','=','criterion_objective_outcome.outcome_id')
334
-              ->join('objectives','objectives.id','=','criterion_objective_outcome.objective_id')
332
+          $result_objectives = DB::table('objective_outcome')
333
+              ->join('outcomes','outcomes.id','=','objective_outcome.outcome_id')
334
+              ->join('objectives','objectives.id','=','objective_outcome.objective_id')
335
               ->join('objective_program','objective_program.objective_id','=','objectives.id')
335
               ->join('objective_program','objective_program.objective_id','=','objectives.id')
336
               ->where('objective_program.program_id',$program_id)
336
               ->where('objective_program.program_id',$program_id)
337
-              ->where('criterion_objective_outcome.outcome_id',$outcome_id)
337
+              ->where('objective_outcome.outcome_id',$outcome_id)
338
               ->select('objectives.id','objectives.text','outcomes.name as outcome_name')
338
               ->select('objectives.id','objectives.text','outcomes.name as outcome_name')
339
               ->orderBy('objectives.text', 'asc')
339
               ->orderBy('objectives.text', 'asc')
340
               ->get();
340
               ->get();
407
         // buscar info sobre selected_semsters
407
         // buscar info sobre selected_semsters
408
         $outcome_->selected_semesters = array();
408
         $outcome_->selected_semesters = array();
409
         foreach ($result_semesters as $semesters_) {
409
         foreach ($result_semesters as $semesters_) {
410
-          $semester_id = $semesters_->semester_id;
411
-
412
           $typ_semester_outcome_id = $semesters_->id;
410
           $typ_semester_outcome_id = $semesters_->id;
413
           $result_objectives = DB::table('typ_semester_objectives')
411
           $result_objectives = DB::table('typ_semester_objectives')
414
               ->join('objectives','objectives.id','=','typ_semester_objectives.objective_id')
412
               ->join('objectives','objectives.id','=','typ_semester_objectives.objective_id')
419
 
417
 
420
           $semesters_->selected_objectives = array();
418
           $semesters_->selected_objectives = array();
421
           foreach ($result_objectives as $objectives_) {
419
           foreach ($result_objectives as $objectives_) {
422
-            $objective_id = $objectives_->objective_id;
423
-            $program_id = $objectives_->program_id;
424
-            $result_courses = DB::table('objective_program')
425
-                ->join('objectives','objectives.id','=','objective_program.objective_id')
426
-                ->join('courses','courses.program_id','=','objective_program.program_id')
427
-                ->where('objective_program.objective_id', $objective_id)
428
-                ->where('objective_program.program_id', $program_id)
429
-                ->where('courses.semester_id', $semester_id)
430
-                ->distinct('courses.name','courses.code')
431
-                ->select('courses.id as course_id','courses.name','courses.code','objective_program.objective_id','objective_program.program_id')
420
+            $result_courses = DB::table('courses')
421
+                ->where('courses.program_id', $program_id)
422
+                ->select('courses.id as course_id','courses.name','courses.code','courses.program_id')
432
                 ->orderBy('courses.name', 'asc')
423
                 ->orderBy('courses.name', 'asc')
433
                 ->groupBy('courses.name','courses.code')
424
                 ->groupBy('courses.name','courses.code')
434
                 ->get();
425
                 ->get();
426
+            #los cursos resultantes creo que deberian ser: todos los que se estan dando en mi programa
435
 
427
 
436
             $objectives_->available_courses = array();
428
             $objectives_->available_courses = array();
437
             foreach ($result_courses as $courses_) {
429
             foreach ($result_courses as $courses_) {