@@ -296,7 +296,7 @@ This gets a single global/default setting.
296296
297297=over
298298
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
300300on the setting.
301301
302302=item * C<$as_result_set > , a boolean if the return is to be a result_set
@@ -315,11 +315,10 @@ sub getGlobalSetting ($self, %args) {
315315
316316 DB::Exception::SettingNotFound-> throw(message => $setting_info -> {setting_name }
317317 ? " 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" )
319319 unless $global_setting ;
320320 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 };
323322}
324323
325324=head2 getCourseSettings
@@ -369,7 +368,7 @@ This gets a single course setting.
369368
370369=over
371370
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
373372on the setting.
374373
375374=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
388387sub getCourseSetting ($self , %args ) {
389388 my $global_setting = $self -> getGlobalSetting(info => $args {info }, as_result_set => 1);
390389 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." )
392391 unless defined ($global_setting );
393392
394393 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 });
396395
397396 DB::Exception::SettingNotFound-> throw(
398397 message => ' The course setting with '
399398 . (
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 "
402401 )
403402 . (
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}"
406405 )
407406 ) unless defined ($setting );
408407
@@ -425,7 +424,7 @@ Update a single course setting.
425424=over
426425
427426=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 > ).
429428
430429=item * C<params > the updated value of the course setting.
431430
@@ -446,14 +445,12 @@ sub updateCourseSetting ($self, %args) {
446445 my $course = $self -> getCourse(info => getCourseInfo($args {info }), as_result_set => 1);
447446 my $global_setting = $self -> getGlobalSetting(info => getSettingInfo($args {info }));
448447
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 } });
452449
453450 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 }
457454 };
458455
459456 isValidSetting($global_setting , $params -> {value });
@@ -462,12 +459,9 @@ sub updateCourseSetting ($self, %args) {
462459 defined ($course_setting ) ? $course_setting -> update($params ) : $course -> add_to_course_settings($params );
463460
464461 return $up_setting if $args {as_result_set };
465- my $setting_to_return =
466- ($args {merged })
462+ return ($args {merged })
467463 ? { $up_setting -> get_inflated_columns, $up_setting -> global_setting-> get_inflated_columns }
468464 : { $up_setting -> get_inflated_columns };
469-
470- return $setting_to_return ;
471465}
472466
473467=pod
@@ -481,7 +475,7 @@ Delete a single course setting.
481475=over
482476
483477=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 > ).
485479
486480=item * C<$as_result_set > , a boolean if the return is to be a result_set
487481
0 commit comments