--- loncom/interface/loncommon.pm 2021/09/11 14:59:37 1.1075.2.155 +++ loncom/interface/loncommon.pm 2021/09/11 15:57:33 1.1075.2.156 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1075.2.155 2021/09/11 14:59:37 raeburn Exp $ +# $Id: loncommon.pm,v 1.1075.2.156 2021/09/11 15:57:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -10427,15 +10427,11 @@ sub sorted_inst_types { } sub get_institutional_codes { - my ($cdom,$crs,$settings,$allcourses,$LC_code) = @_; + my ($settings,$allcourses,$LC_code) = @_; # Get complete list of course sections to update my @currsections = (); my @currxlists = (); - my (%unclutteredsec,%unclutteredlcsec); my $coursecode = $$settings{'internal.coursecode'}; - my $crskey = $crs.':'.$coursecode; - @{$unclutteredsec{$crskey}} = (); - @{$unclutteredlcsec{$crskey}} = (); if ($$settings{'internal.sectionnums'} ne '') { @currsections = split(/,/,$$settings{'internal.sectionnums'}); @@ -10446,8 +10442,8 @@ sub get_institutional_codes { } if (@currxlists > 0) { - foreach my $xl (@currxlists) { - if ($xl =~ /^([^:]+):(\w*)$/) { + foreach (@currxlists) { + if (m/^([^:]+):(\w*)$/) { unless (grep/^$1$/,@{$allcourses}) { push(@{$allcourses},$1); $$LC_code{$1} = $2; @@ -10455,28 +10451,15 @@ sub get_institutional_codes { } } } - + if (@currsections > 0) { - foreach my $sec (@currsections) { - if ($sec =~ m/^(\w+):(\w*)$/ ) { - my $instsec = $1; + foreach (@currsections) { + if (m/^(\w+):(\w*)$/) { + my $sec = $coursecode.$1; my $lc_sec = $2; - unless (grep/^\Q$instsec\E$/,@{$unclutteredsec{$crskey}}) { - push(@{$unclutteredsec{$crskey}},$instsec); - push(@{$unclutteredlcsec{$crskey}},$lc_sec); - } - } - } - } - - if (@{$unclutteredsec{$crskey}} > 0) { - my %formattedsec = &Apache::lonnet::auto_instsec_reformat($cdom,'clutter',\%unclutteredsec); - if ((ref($formattedsec{$crskey}) eq 'ARRAY') && (ref($unclutteredlcsec{$crskey}) eq 'ARRAY')) { - for (my $i=0; $i<@{$formattedsec{$crskey}}; $i++) { - my $sec = $coursecode.$formattedsec{$crskey}[$i]; - unless (grep/^\Q$sec\E$/,@{$allcourses}) { + unless (grep/^$sec$/,@{$allcourses}) { push(@{$allcourses},$sec); - $$LC_code{$sec} = $unclutteredlcsec{$crskey}[$i]; + $$LC_code{$sec} = $lc_sec; } } }