@@ -296,7 +296,7 @@ This gets a single global/default setting.
296
296
297
297
=over
298
298
299
- =item * C<info > which is a hash of either a C<setting_id > or C<setting_name > with information
299
+ =item * C<info > which is a hash of either a C<global_setting_id > or C<setting_name > with information
300
300
on the setting.
301
301
302
302
=item * C<$as_result_set > , a boolean if the return is to be a result_set
@@ -315,11 +315,10 @@ sub getGlobalSetting ($self, %args) {
315
315
316
316
DB::Exception::SettingNotFound-> throw(message => $setting_info -> {setting_name }
317
317
? " The setting with name $setting_info ->{setting_name} is not found"
318
- : " The setting with setting_id $setting_info ->{setting_id } is not found" )
318
+ : " The setting with global_setting_id $setting_info ->{global_setting_id } is not found" )
319
319
unless $global_setting ;
320
320
return $global_setting if $args {as_result_set };
321
- my $setting_to_return = { $global_setting -> get_inflated_columns };
322
- return $setting_to_return ;
321
+ return { $global_setting -> get_inflated_columns };
323
322
}
324
323
325
324
=head2 getCourseSettings
@@ -369,7 +368,7 @@ This gets a single course setting.
369
368
370
369
=over
371
370
372
- =item * C<info > which is a hash of either a C<setting_id > or C<setting_name > with information
371
+ =item * C<info > which is a hash of either a C<global_setting_id > or C<setting_name > with information
373
372
on the setting.
374
373
375
374
=item * C<merged > , a boolean on whether the course setting is merged with its corresponding
@@ -388,21 +387,21 @@ A single course setting as either a hashref or a C<DBIx::Class::ResultSet::Cours
388
387
sub getCourseSetting ($self , %args ) {
389
388
my $global_setting = $self -> getGlobalSetting(info => $args {info }, as_result_set => 1);
390
389
DB::Exception::SettingNotFound-> throw(
391
- message => " The global setting with name: '" . $args {info }-> {setting_name } . " ' is not a defined info ." )
390
+ message => " The global setting with name: '" . $args {info }{setting_name } . " ' is not defined." )
392
391
unless defined ($global_setting );
393
392
394
393
my $course = $self -> getCourse(info => getCourseInfo($args {info }), as_result_set => 1);
395
- my $setting = $course -> course_settings-> find({ setting_id => $global_setting -> setting_id });
394
+ my $setting = $course -> course_settings-> find({ global_setting_id => $global_setting -> global_setting_id });
396
395
397
396
DB::Exception::SettingNotFound-> throw(
398
397
message => ' The course setting with '
399
398
. (
400
- $args {info }-> {setting_name } ? " name: '$args {info}-> {setting_name}'"
401
- : " setting_id of $args {info}->{setting_id } is not a found in the course "
399
+ $args {info }{setting_name } ? " name: '$args {info}{setting_name}'"
400
+ : " global_setting_id of $args {info}{global_setting_id } is not found in the course "
402
401
)
403
402
. (
404
- $args {info }-> {course_name } ? (" with name '" . $args {info }-> {course_name } . " '" )
405
- : " with course_id of $args {info}-> {course_id}"
403
+ $args {info }{course_name } ? (" with name '" . $args {info }{course_name } . " '" )
404
+ : " with course_id of $args {info}{course_id}"
406
405
)
407
406
) unless defined ($setting );
408
407
@@ -425,7 +424,7 @@ Update a single course setting.
425
424
=over
426
425
427
426
=item * C<info > which is a hash containing information about the course (either a
428
- C<course_id > or C<course_name > ) and a setting (either a C<setting_id > or C<setting_name > ).
427
+ C<course_id > or C<course_name > ) and a setting (either a C<global_setting_id > or C<setting_name > ).
429
428
430
429
=item * C<params > the updated value of the course setting.
431
430
@@ -446,14 +445,12 @@ sub updateCourseSetting ($self, %args) {
446
445
my $course = $self -> getCourse(info => getCourseInfo($args {info }), as_result_set => 1);
447
446
my $global_setting = $self -> getGlobalSetting(info => getSettingInfo($args {info }));
448
447
449
- my $course_setting = $course -> course_settings-> find({
450
- setting_id => $global_setting -> {setting_id }
451
- });
448
+ my $course_setting = $course -> course_settings-> find({ global_setting_id => $global_setting -> {global_setting_id } });
452
449
453
450
my $params = {
454
- course_id => $course -> course_id,
455
- setting_id => $global_setting -> {setting_id },
456
- value => $args {params }{value }
451
+ course_id => $course -> course_id,
452
+ global_setting_id => $global_setting -> {global_setting_id },
453
+ value => $args { params }{ value } =~ / ^ $ / ? undef : $args {params }{value }
457
454
};
458
455
459
456
isValidSetting($global_setting , $params -> {value });
@@ -462,12 +459,9 @@ sub updateCourseSetting ($self, %args) {
462
459
defined ($course_setting ) ? $course_setting -> update($params ) : $course -> add_to_course_settings($params );
463
460
464
461
return $up_setting if $args {as_result_set };
465
- my $setting_to_return =
466
- ($args {merged })
462
+ return ($args {merged })
467
463
? { $up_setting -> get_inflated_columns, $up_setting -> global_setting-> get_inflated_columns }
468
464
: { $up_setting -> get_inflated_columns };
469
-
470
- return $setting_to_return ;
471
465
}
472
466
473
467
=pod
@@ -481,7 +475,7 @@ Delete a single course setting.
481
475
=over
482
476
483
477
=item * C<info > which is a hash containing information about the course (either a
484
- C<course_id > or C<course_name > ) and a setting (either a C<setting_id > or C<setting_name > ).
478
+ C<course_id > or C<course_name > ) and a setting (either a C<global_setting_id > or C<setting_name > ).
485
479
486
480
=item * C<$as_result_set > , a boolean if the return is to be a result_set
487
481
0 commit comments