[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Mon Apr 2 13:27:52 EDT 2018


raeburn		Mon Apr  2 17:27:52 2018 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  responseorder metadata-field for problem with imported library/problem
    - prepending import id to response id to create responseorder item for
      each import tag now occurs sooner in &metadata().
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1372 loncom/lonnet/perl/lonnet.pm:1.1373
--- loncom/lonnet/perl/lonnet.pm:1.1372	Fri Mar 30 23:50:29 2018
+++ loncom/lonnet/perl/lonnet.pm	Mon Apr  2 17:27:52 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1372 2018/03/30 23:50:29 raeburn Exp $
+# $Id: lonnet.pm,v 1.1373 2018/04/02 17:27:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -11940,8 +11940,11 @@
                                     undef(%importedrespids);
                                     undef(%importedpartids);
                                 }
-                                @{$importedrespids{$importid}} = split(/\s*,\s*/,$libresponseorder);
-                                if (@{$importedrespids{$importid}} > 0) {
+                                my @respids = split(/\s*,\s*/,$libresponseorder);
+                                if (@respids) {
+                                    $importedrespids{$importid} = join(',',map { $importid.'_'.$_ } @respids);
+                                }
+                                if ($importedrespids{$importid} ne '') {
                                     $importedresponses = 1;
 # We need to get the original file and the imported file to get the response order correct
 # Load and inspect original file
@@ -12120,12 +12123,14 @@
                 } elsif ($origfiletagids[$index] eq 'import') {
                     if ($importedparts) {
 # We have imported parts at this position
-                        $metaentry{':partorder'}.=','.$importedpartids{$origid};
+                        if ($importedpartids{$origid} ne '') {
+                            $metaentry{':partorder'}.=','.$importedpartids{$origid};
+                        }
                     }
                     if ($importedresponses) {
 # We have imported responses at this position
-                        if (ref($importedrespids{$origid}) eq 'ARRAY') {
-                            $metaentry{':responseorder'}.=','.join(',',map { $origid.'_'.$_ } @{$importedrespids{$origid}});
+                        if ($importedrespids{$origid} ne '') {
+                            $metaentry{':responseorder'}.=','.$importedrespids{$origid};
                         }
                     }
                 } else {




More information about the LON-CAPA-cvs mailing list