Selaa lähdekoodia

corrigiendo bugs

Carlos J Corrada Bravo 2 vuotta sitten
vanhempi
commit
793645227e

+ 1
- 0
app/controllers/CriteriaController.php Näytä tiedosto

@@ -130,6 +130,7 @@ class CriteriaController extends \BaseController
130 130
             ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
131 131
             ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
132 132
             ->where('outcome_id', '=', $outcome_id)
133
+            ->where('objectives.id', '<>', 0)
133 134
             ->whereIn('program_id', $program_ids)
134 135
             ->select('objectives.*', 'objective_outcome.*')
135 136
             ->distinct()

+ 8
- 1
app/controllers/Objective2Controller.php Näytä tiedosto

@@ -228,13 +228,20 @@ class Objective2Controller extends \BaseController
228 228
 				}
229 229
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
230 230
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
231
-
232 231
 					/*if (!($objectiveOutcome->save())) {
233 232
 						Session::flash('status', 'danger');
234 233
 						Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
235 234
 						return Redirect::to('objective')->withInput();
236 235
 					}*/
237 236
 				}
237
+				DB::table('criterion_objective_outcome')
238
+				->join('program_criterion' , 'criterion_objective_outcome.criterion_id',"=",'program_criterion.criterion_id')
239
+				->whereIn('program_id',$clean_input['program_id'])
240
+				->whereIn('outcome_id',$clean_input['outcome_id'])
241
+				->where('objective_id','=',0)
242
+				->update(array('objective_id'=>$objectiveId));
243
+// 				update("update criterion_objective_outcome coo join program_criterion pc on coo.criterion_id=pc.criterion_id set 
244
+// 				objective_id= {$objectiveId} where program_id in (".$clean_input['program_id'].") and objective_id=0 and outcome_id in (".$clean_input['outcome_id'].")");
238 245
 
239 246
 				Session::flash('status', 'success');
240 247
 				Session::flash('message', 'Objective created: "' . $objective->text . '".');

+ 2
- 1
app/controllers/OutcomesController.php Näytä tiedosto

@@ -406,7 +406,8 @@ class OutcomesController extends \BaseController
406 406
 
407 407
     public function fetchCriteria()
408 408
     {
409
-
409
+// 		var_dump((Input::get('filter')));
410
+// 		exit();
410 411
         if (Input::get('filter')) {
411 412
             switch (Input::get('filter')) {
412 413
                 case 'all':

+ 7
- 1
app/controllers/TemplatesController.php Näytä tiedosto

@@ -378,6 +378,8 @@ class TemplatesController extends \BaseController
378 378
 			->join('template_criterion', 'template_criterion.criterion_id', '=', 'criteria.id')
379 379
 			->where("template_criterion.template_id", '=', Input::get('id'))
380 380
 			->get();
381
+				Log::info(json_encode($template_info['criterion']));
382
+// 				Log::info(($temp_crit->program_ids));
381 383
 		foreach ($template_info['criterion'] as $temp_crit) {
382 384
 			$temp_crit->scales = DB::table('scales')
383 385
 				->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
@@ -388,6 +390,9 @@ class TemplatesController extends \BaseController
388 390
 			$temp_crit->program_ids = json_encode(DB::table('program_criterion')
389 391
 				->where('criterion_id', $temp_crit->id)
390 392
 				->lists('program_id'));
393
+				
394
+						Log::info("ee".json_encode($temp_crit->program_ids));
395
+		
391 396
 			$temp_crit->objectives = DB::table('criterion_objective_outcome')
392 397
 				->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
393 398
 				->where('criterion_id', $temp_crit->id)
@@ -404,6 +409,7 @@ class TemplatesController extends \BaseController
404 409
 			$outcomeStr = rtrim($outcomeStr, ',');
405 410
 			$temp_crit->outcomes = $outcomeStr;
406 411
 		}
412
+		Log::info("ee2".json_encode($template_info));
407 413
 
408 414
 		$template_info['titles'] = DB::table('titles')
409 415
 			->join('template_title', 'template_title.title_id', '=', 'titles.id')
@@ -411,7 +417,7 @@ class TemplatesController extends \BaseController
411 417
 			->orderBy('position')
412 418
 			->get();
413 419
 
414
-		Log::info($template_info);
420
+// 		Log::info(json_encode($template_info));
415 421
 
416 422
 		return json_encode($template_info);
417 423
 	}

+ 10
- 6
app/views/local/managers/shared/rubrics_new.blade.php Näytä tiedosto

@@ -528,13 +528,13 @@ function fetchCriteria(outcome, objective)
528 528
         function(data)
529 529
         {
530 530
             $('#select-criterion').empty();
531
-
531
+		console.log(data);
532 532
             // Append criteria
533 533
             data.forEach( function (arrayItem)
534 534
             {
535 535
                 objectives = JSON.stringify(arrayItem.objectives);
536 536
                 $('#select-criterion')
537
-                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = "'+arrayItem.program_ids+'" data-assoc-objectives= '+"'"+objectives+"'"+'>'+arrayItem.name+'</option>');
537
+                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = '+"'"+arrayItem.program_ids+"'"+' data-assoc-objectives= '+"'"+objectives+"'"+'>'+arrayItem.name+'</option>');
538 538
             });
539 539
 
540 540
             // If there are no criteria assigned to the selected outcome, disable the
@@ -932,12 +932,15 @@ function loadTemplate()
932 932
 
933 933
             // Set the contents of the rubric
934 934
             var temp_criterion = data.criterion;
935
+               console.log(temp_criterion);
935 936
             for(temp_c in temp_criterion){
936 937
                 current_criterion = temp_criterion[temp_c]
938
+               console.log(current_criterion.program_ids);
937 939
                 objectives = JSON.stringify(current_criterion.objectives);
938
-               
939
-                var str = '<tr data-assoc-objectives= '+"'"+objectives+"'"+' data-program_ids = "'+current_criterion.program_ids+'" data-criterion-name = "'+current_criterion.name+'" data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
940
-                
940
+                //var str = '<tr data-assoc-objectives= '+"'"+objectives+"'"+' data-program_ids = "'+current_criterion.program_ids+'" data-criterion-name = "'+current_criterion.name+'" data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
941
+                var str = "<tr data-assoc-objectives= "+"'"+objectives+"'"+" data-program_ids = '"+current_criterion.program_ids+"' data-criterion-name = '"+current_criterion.name+"' data-criterion-id='"+temp_criterion[temp_c].criterion_id+"' data-criterion-copyright='"+temp_criterion[temp_c].copyright+"' data-criterion-notes='"+temp_criterion[temp_c].notes+"' data-outcomes = '"+temp_criterion[temp_c].outcomes+"'><th><span class='glyphicon glyphicon-move'></span></th><td>";
942
+                console.log(str);
943
+
941 944
                 var subcriteria ='';
942 945
                 if(current_criterion.subcriteria){
943 946
                     var subcriteria_array = JSON.parse(current_criterion.subcriteria);
@@ -967,6 +970,7 @@ function loadTemplate()
967 970
                 str+= '<td>'+current_criterion.outcomes+'</td>'
968 971
   
969 972
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
973
+                console.log(str);
970 974
 
971 975
     $('table tbody').append(str);
972 976
 
@@ -1412,7 +1416,7 @@ $('.save').on('click', function(e)
1412 1416
             htmlString = '';
1413 1417
             console.log($(this));
1414 1418
 
1415
-            program_ids = $(this).data('program-ids')
1419
+            program_ids = $(this).data('program_ids')
1416 1420
             if(!program_ids.includes(program_id) ){
1417 1421
                 title = "<h6>The following criteria and objectives will be matched with this program</h6>"
1418 1422
                 htmlString += "<ol style='list-style-position: inside'>"