Bladeren bron

pal de bugs

Gabriel Santiago Plaza 2 jaren geleden
bovenliggende
commit
350bf3841c

+ 8
- 6
app/controllers/ActivitiesController.php Bestand weergeven

@@ -147,15 +147,15 @@ class ActivitiesController extends \BaseController
147 147
             ->whereRaw("(deactivation_date IS NULL or deactivation_date >= '{$semesters->start}')")
148 148
             ->orderBy('name', 'ASC')->get();*/
149 149
 
150
-//         $outcomes = Outcome::orderBy('name', 'asc')->get();
151
-		 $level = DB::table('courses')
150
+        //         $outcomes = Outcome::orderBy('name', 'asc')->get();
151
+        $level = DB::table('courses')
152 152
             ->join('programs', 'programs.id', '=', 'courses.program_id')
153 153
             ->where('courses.id', $activity->course_id)
154
-//             ->where('courses.number', $number)
155
-//             ->where('courses.semester_id', $semester->id)
154
+            //             ->where('courses.number', $number)
155
+            //             ->where('courses.semester_id', $semester->id)
156 156
             ->select('programs.is_graduate')
157 157
             ->first();
158
-            $outcomes = Outcome::active_by_semesters(array($course->semester), $level->is_graduate);
158
+        $outcomes = Outcome::active_by_semesters(array($course->semester), $level->is_graduate);
159 159
 
160 160
         $assessment = DB::table('assessments')
161 161
             ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
@@ -998,6 +998,8 @@ class ActivitiesController extends \BaseController
998 998
 
999 999
 
1000 1000
 
1001
+
1002
+
1001 1003
         return View::make('local.professors.compare_activities', compact('activity_1', 'activity_2', 'activity_criterion_1', 'activity_criterion_2', 'title', 'outcomes', 'outcomes_achieved_1', 'outcomes_attempted_1', 'outcomes_achieved_2', 'outcomes_attempted_2', 'course', 'student_count', 'active_semesters'));
1002 1004
     }
1003
-}
1005
+}

+ 17
- 5
app/controllers/ProfessorsController.php Bestand weergeven

@@ -57,10 +57,22 @@ class ProfessorsController extends \BaseController
57 57
                     //$section_outcomes_attempted = json_decode($section->outcomes_attempted, true);
58 58
                     foreach ($section_outcomes_attempted as $outcome_id => $score) {
59 59
 
60
-                        if (array_key_exists($outcome_id, $outcomes_achieved)) $outcomes_achieved[$outcome_id] += $section_outcomes_achieved[$outcome_id];
61
-                        else $outcomes_achieved[$outcome_id] = $section_outcomes_achieved[$outcome_id];
62
-                        if (array_key_exists($outcome_id, $outcomes_attempted)) $outcomes_attempted[$outcome_id] +=  $section_outcomes_attempted[$outcome_id];
63
-                        else $outcomes_attempted[$outcome_id] =  $section_outcomes_attempted[$outcome_id];
60
+                        if (array_key_exists($outcome_id, $outcomes_achieved) && array_key_exists($outcome_id, $section_outcomes_achieved)) {
61
+
62
+                            $outcomes_achieved[$outcome_id] += $section_outcomes_achieved[$outcome_id];
63
+                        } elseif (array_key_exists($outcome_id, $outcomes_achieved)) {
64
+
65
+                            $outcomes_achieved[$outcome_id] += 0;
66
+                        } elseif (array_key_exists($outcome_id, $section_outcomes_achieved)) {
67
+                            $outcomes_achieved[$outcome_id] = $section_outcomes_achieved[$outcome_id];
68
+                        } else {
69
+                            $outcomes_achieved[$outcome_id] = 0;
70
+                        }
71
+                        if (array_key_exists($outcome_id, $outcomes_attempted)) {
72
+                            $outcomes_attempted[$outcome_id] +=  $section_outcomes_attempted[$outcome_id];
73
+                        } else {
74
+                            $outcomes_attempted[$outcome_id] =  $section_outcomes_attempted[$outcome_id];
75
+                        }
64 76
                         //$outcomes_achieved[$outcome_id] += $section_outcomes_achieved[$outcome_id];
65 77
                         //$outcomes_attempted[$outcome_id] += $section_outcomes_attempted[$outcome_id];
66 78
                     }
@@ -151,4 +163,4 @@ class ProfessorsController extends \BaseController
151 163
 
152 164
         return View::make('local.managers.shared.general_studies_overview', compact('title', 'outcomes', 'schools', 'program_packs'));
153 165
     }
154
-}
166
+}

+ 32
- 0
app/database/migrations/2022_01_19_100041_add_deleted_at_objectives.php Bestand weergeven

@@ -0,0 +1,32 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class AddDeletedAtObjectives extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::table('objectives', function (Blueprint $table) {
17
+			$table->date('deleted_at')->nullable();
18
+		});
19
+	}
20
+
21
+	/**
22
+	 * Reverse the migrations.
23
+	 *
24
+	 * @return void
25
+	 */
26
+	public function down()
27
+	{
28
+		Schema::table('objectives', function (Blueprint $table) {
29
+			$table->dropColumn('deleted_at');
30
+		});
31
+	}
32
+}

+ 15
- 13
app/models/Course.php Bestand weergeven

@@ -111,6 +111,8 @@ class Course extends Eloquent
111 111
         else $outcomes_attempted[$outcome_id] = 1;
112 112
       }
113 113
     }
114
+    Log::info("outcomes_attempted");
115
+    Log::info($outcomes_attempted);
114 116
 
115 117
     return $outcomes_attempted;
116 118
   }
@@ -361,18 +363,18 @@ class Course extends Eloquent
361 363
     return $all_sections;
362 364
   }
363 365
 
364
-    public function isAssessed()
365
-    {
366
-         $assessed = DB::table('assessments')
367
-            ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
368
-            ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
369
-             ->where('activities.course_id', $this->id)
370
-            ->count();
371
-//             Log::info("aqui".$assessed);
372
-
373
-   		if($assessed)return true;
374
-   		else return false;
375
-    }
366
+  public function isAssessed()
367
+  {
368
+    $assessed = DB::table('assessments')
369
+      ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
370
+      ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
371
+      ->where('activities.course_id', $this->id)
372
+      ->count();
373
+    //             Log::info("aqui".$assessed);
374
+
375
+    if ($assessed) return true;
376
+    else return false;
377
+  }
376 378
 
377 379
 
378 380
   public function outcomes_achieved()
@@ -421,4 +423,4 @@ class Course extends Eloquent
421 423
       $query->where('outcomes_attempted', 'not like', '\'%"' . $outcome_id . '":0%\'');
422 424
     }))->where('code', $this->code)->where('number', $this->number)->get();
423 425
   }
424
-}
426
+}

+ 4
- 2
app/views/local/managers/admins/new_assessment_report.blade.php Bestand weergeven

@@ -251,8 +251,10 @@
251 251
                                                     $expected = DB::table('target_outcomes_program')
252 252
                                                         ->where('program_id', $course->program_id)
253 253
                                                         ->where('semester_id', $course->semester_id)
254
-                                                        ->first()->expected_target;
255
-                                                    
254
+                                                        ->first();//->expected_target;
255
+                                                    if(!$expected){
256
+                                                        $expected = "It has not been defined in the annual plan";
257
+                                                    }
256 258
                                                     ?>
257 259
                                                     {{ $expected }}
258 260
                                                 </i>

+ 4
- 1
app/views/local/managers/pCoords/new_assessment_report.blade.php Bestand weergeven

@@ -226,7 +226,10 @@
226 226
                                             $expected = DB::table('target_outcomes_program')
227 227
                                                 ->where('program_id', $course->program_id)
228 228
                                                 ->where('semester_id', $course->semester_id)
229
-                                                ->first()->expected_target;
229
+                                                ->first();
230
+                                                if(!$expected){
231
+                                                        $expected = "It has not been defined in the annual plan";
232
+                                                    }
230 233
                                             
231 234
                                             ?>
232 235
                                             {{ $expected }}

+ 120
- 16
app/views/local/managers/sCoords/criteria.blade.php Bestand weergeven

@@ -151,13 +151,15 @@
151 151
                             onchange='fetchCriterionForEditing()'>
152 152
                             @foreach ($criteria as $criterion)
153 153
                                 <option value="{{ $criterion->id }}" data-subtext="
154
-                                                                                                                                                                                                                                                                                                                                                                                  
155
-                                                                                                                                                                                                                                                                                                                                   
156
-                                                                                                                                                                                                                                                                                   
157
-                                                                                                                                                                                                                                   
158
-                                                                                                                                                                                   
159
-                                                                                                                                   
160
-                                                                                 @if ($criterion->program)
154
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
155
+                                                                                                                                                                                                                                                                                                                                                                                                                       
156
+                                                                                                                                                                                                                                                                                                                                                                       
157
+                                                                                                                                                                                                                                                                                                                       
158
+                                                                                                                                                                                                                                                                       
159
+                                                                                                                                                                                                                       
160
+                                                                                                                                                                       
161
+                                                                                                                       
162
+                                                                  @if ($criterion->program)
161 163
                                     &nbsp;&nbsp;&nbsp;[{{ $criterion->program->name }}]
162 164
                             @endif
163 165
                             ">
@@ -317,7 +319,8 @@
317 319
                 what = $(submitter).data('form-id');
318 320
                 form_id = $(submitter).data('form-id');
319 321
                 form = $("#" + form_id)
320
-                form = $("#" + form_id).children('div')
322
+                form = $("#" + form_id).children('div');
323
+
321 324
 
322 325
                 $("#" + form_id).children('.form_validation').each(function(index) {
323 326
                     //alert($(this).attr('id') + '   ' + index);
@@ -404,7 +407,7 @@
404 407
                     } else if ($(this).hasClass('program_form')) {
405 408
                         checkedboxes = $(this).children('input[type="checkbox"]:checked').length;
406 409
                         if (!checkedboxes) {
407
-                            var timer;
410
+
408 411
 
409 412
                             alert = $('<div/>', {
410 413
                                 'class': 'alert alert-danger alert-dismissible',
@@ -422,12 +425,13 @@
422 425
                             $(this).prepend(alert);
423 426
                             $('html, body').animate({
424 427
                                 scrollTop: $(alert).offset().top
425
-                            }, 1000);
428
+                            }, 300);
426 429
                             //$(divGroup).focus();
427 430
                             isEverythingOkay = false;
428 431
                         }
429 432
 
430 433
                     } else if ($(this).hasClass('name_form')) {
434
+
431 435
                         input = $(this).children('input')[0];
432 436
                         if ($(input).val() == '') {
433 437
                             var timer;
@@ -448,17 +452,92 @@
448 452
                             $(this).prepend(alert);
449 453
                             $('html, body').animate({
450 454
                                 scrollTop: $(alert).offset().top
451
-                            }, 1000);
455
+                            }, 300);
452 456
                             //$(divGroup).focus();
453 457
                             isEverythingOkay = false;
454 458
                         }
455 459
 
456 460
                     } else if ($(this).hasClass('maximum_form')) {
461
+                        input = $(this).children('input')[0];
462
+                        if (isNaN($(input).val())) {
463
+                            alert = $('<div/>', {
464
+                                'class': 'alert alert-danger alert-dismissible',
465
+                                'role': 'alert'
466
+                            })
467
+                            button = $('<button/>', {
468
+                                'type': 'button',
469
+                                'class': 'close',
470
+                                'data-dismiss': 'alert',
471
+                                'alert-label': 'close'
472
+                            }).html('<span aria-hidden="true">×</span>');
473
+                            alert.append(button);
474
+                            alert.append('<strong>Write a valid number for maximum score</strong>')
457 475
 
476
+                            $(this).prepend(alert);
477
+                            $('html, body').animate({
478
+                                scrollTop: $(alert).offset().top
479
+                            }, 300);
480
+                            //$(divGroup).focus();
481
+                            isEverythingOkay = false;
482
+                        }
458 483
 
459
-                    } else if ($(this).hasClass('scales_form')) {
460 484
 
461 485
                     } else if ($(this).hasClass('number_of_scales')) {
486
+                        btn_group = $(this).children('div.btn-group')[0];
487
+                        select = $(btn_group).children('select')[0];
488
+                        if (isNaN($(select).val())) {
489
+
490
+                            alert = $('<div/>', {
491
+                                'class': 'alert alert-danger alert-dismissible',
492
+                                'role': 'alert'
493
+                            })
494
+                            button = $('<button/>', {
495
+                                'type': 'button',
496
+                                'class': 'close',
497
+                                'data-dismiss': 'alert',
498
+                                'alert-label': 'close'
499
+                            }).html('<span aria-hidden="true">×</span>');
500
+                            alert.append(button);
501
+                            alert.append('<strong>Select a valid number</strong>')
502
+
503
+                            $(this).prepend(alert);
504
+                            $('html, body').animate({
505
+                                scrollTop: $(alert).offset().top
506
+                            }, 300);
507
+                            //$(divGroup).focus();
508
+                            isEverythingOkay = false;
509
+                        }
510
+
511
+                    } else if ($(this).hasClass('scales_form')) {
512
+
513
+                        //amount_of_scales = parseInt($(this).data('value'));
514
+
515
+                        $.each($(this).children('div'), function() {
516
+                            form_group = $(this).children('div.form-group')[0];
517
+                            textarea = $(form_group).children('textarea')[0];
518
+                            if ($(textarea).val() == '') {
519
+                                alert = $('<div/>', {
520
+                                    'class': 'alert alert-danger alert-dismissible',
521
+                                    'role': 'alert'
522
+                                })
523
+                                button = $('<button/>', {
524
+                                    'type': 'button',
525
+                                    'class': 'close',
526
+                                    'data-dismiss': 'alert',
527
+                                    'alert-label': 'close'
528
+                                }).html('<span aria-hidden="true">×</span>');
529
+                                alert.append(button);
530
+                                alert.append('<strong>Make sure to fill this scale</strong>')
531
+
532
+                                $(form_group).prepend(alert);
533
+                                $('html, body').animate({
534
+                                    scrollTop: $(alert).offset().top
535
+                                }, 300);
536
+                                //$(divGroup).focus();
537
+                                isEverythingOkay = false;
538
+                            }
539
+                        })
540
+
462 541
 
463 542
                     } else return;
464 543
 
@@ -467,9 +546,9 @@
467 546
                 })
468 547
 
469 548
 
470
-                //BORRAR
471
-                //if (!isEverythingOkay)
472
-                e.preventDefault();
549
+
550
+                if (!isEverythingOkay)
551
+                    e.preventDefault();
473 552
 
474 553
 
475 554
             } else e.preventDefault();
@@ -486,11 +565,17 @@
486 565
         visibleProgram["allAssocOutcomes"] = {}
487 566
         visibleProgram["allOutcomes"] = {}
488 567
 
568
+
489 569
         function visiblePrograms(allOutcomesDiv) {
570
+            checkedPrograms = {}
490 571
             $('#' + allOutcomesDiv).parent().find('input:checkbox').each(function(index) {
491 572
 
492 573
                 id = $(this).attr('id');
493
-                $(this).prop("checked", false);
574
+                if ($(this).is(':checked')) {
575
+                    checkedPrograms[$(this).attr('id')] = 1;
576
+                    $(this).prop("checked", false);
577
+                }
578
+
494 579
                 program_id = $(this).val();
495 580
                 if (!(program_id in visibleProgram[allOutcomesDiv])) {
496 581
                     visibleProgram[allOutcomesDiv][program_id] = {};
@@ -502,6 +587,8 @@
502 587
             })
503 588
             if (allOutcomesDiv == "allOutcomes") {
504 589
                 $('#' + allOutcomesDiv).parent().find("select[name='objective[]']").each(function(index) {
590
+
591
+                    //program_ids in objective
505 592
                     var the_programs = $(this).find(':selected').data('program-ids');
506 593
                     if (!the_programs) return;
507 594
 
@@ -509,11 +596,21 @@
509 596
                     for (index in the_programs) {
510 597
                         program_id = the_programs[index];
511 598
 
599
+                        //if the program_id is inside the visibleProgram scope
600
+                        //and the checkbox isnt alread present
601
+
512 602
                         if (program_id in visibleProgram[allOutcomesDiv] &&
513 603
                             !($('#program-checkboxes').find('#' + visibleProgram[allOutcomesDiv][program_id][
514 604
                                 'checkbox'
515 605
                             ].attr('id')).val())) {
606
+                            //if it was checked, check it again
607
+                            id = visibleProgram[allOutcomesDiv][program_id]['checkbox'].attr('id');
608
+                            if (checkedPrograms[id]) {
609
+                                visibleProgram[allOutcomesDiv][program_id]['checkbox'].prop('checked', true);
610
+                            }
516 611
                             visibleProgram[allOutcomesDiv][program_id]['checkbox'].appendTo('#program-checkboxes');
612
+
613
+
517 614
                             visibleProgram[allOutcomesDiv][program_id]['label'].appendTo("#program-checkboxes");
518 615
                             $('#program-checkboxes').append('<br>');
519 616
 
@@ -535,8 +632,15 @@
535 632
                             !($('#assoc-program-checkboxes').find('#' + visibleProgram[allOutcomesDiv][program_id][
536 633
                                 'checkbox'
537 634
                             ].attr('id')).val())) {
635
+
636
+                            id = visibleProgram[allOutcomesDiv][program_id]['checkbox'].attr('id');
637
+                            if (checkedPrograms[id]) {
638
+                                visibleProgram[allOutcomesDiv][program_id]['checkbox'].prop('checked', true);
639
+
640
+                            }
538 641
                             visibleProgram[allOutcomesDiv][program_id]['checkbox'].appendTo(
539 642
                                 '#assoc-program-checkboxes');
643
+
540 644
                             visibleProgram[allOutcomesDiv][program_id]['label'].appendTo(
541 645
                                 "#assoc-program-checkboxes");
542 646
                             $('#assoc-program-checkboxes').append('<br>');

+ 9
- 3
app/views/local/professors/compare_activities.blade.php Bestand weergeven

@@ -251,10 +251,14 @@
251 251
                         $expected = DB::table('target_outcomes_program')
252 252
                             ->where('program_id', $course->program_id)
253 253
                             ->where('semester_id', $course->semester_id)
254
-                            ->first()->expected_target;
254
+                            ->first();
255
+                            if(!$expected){
256
+                                                        $expected = "It has not been defined in the annual plan";
257
+                                                    }
255 258
                         
256 259
                         ?>
257 260
                         {{ $expected }}
261
+                        
258 262
                     </i>
259 263
                 </p>
260 264
                 <br>
@@ -457,8 +461,10 @@
457 461
                         $expected = DB::table('target_outcomes_program')
458 462
                             ->where('program_id', $course->program_id)
459 463
                             ->where('semester_id', $course->semester_id)
460
-                            ->first()->expected_target;
461
-                        
464
+                            ->first();//->expected_target;
465
+                            if(!$expected){
466
+                                                        $expected = "It has not been defined in the annual plan";
467
+                                                    }
462 468
                         ?>
463 469
                         {{ $expected }}
464 470
                     </i>

+ 4
- 4
app/views/local/professors/course.blade.php Bestand weergeven

@@ -152,9 +152,9 @@
152 152
                               
153 153
                               <select id='select-activity-1' data-count = "1" class="form-control selectpicker" >
154 154
                                   @foreach ($activities as $activity)
155
-                                 
155
+                                 @if($activity->is_assessed())
156 156
                                   <option value='{{$activity->id}}' >{{$activity->name}}</option>
157
-          
157
+                                @endif
158 158
                                   @endforeach
159 159
                               </select>
160 160
                               <hr>
@@ -162,9 +162,9 @@
162 162
 
163 163
                               <select id='select-activity-2' data-count = "1" class="form-control selectpicker" >
164 164
                                 @foreach ($activities as $activity)
165
-                               
165
+                                @if($activity->is_assessed())
166 166
                                 <option value='{{$activity->id}}' >{{$activity->name}}</option>
167
-        
167
+                                @endif
168 168
                                 @endforeach
169 169
                             </select>
170 170
                             <hr>

+ 4
- 1
app/views/local/professors/new_assessment_report.blade.php Bestand weergeven

@@ -241,7 +241,10 @@
241 241
                                      $expected = DB::table('target_outcomes_program')
242 242
         ->where('program_id', $course->program_id)
243 243
         ->where('semester_id', $course->semester_id)
244
-        ->first()->expected_target;
244
+        ->first();//->expected_target;
245
+        if(!$expected){
246
+                                                        $expected = "It has not been defined in the annual plan";
247
+                                                    }
245 248
 
246 249
         
247 250
                                     ?>