[system] / branches / gage_dev / webwork2 / lib / WeBWorK / ContentGenerator / Instructor / ProblemSetDetail.pm Repository:
ViewVC logotype

Diff of /branches/gage_dev/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4929 Revision 4971
432# my $globalValue = $globalRecord->{$field}; 432# my $globalValue = $globalRecord->{$field};
433# my $userValue = $userRecord->{$field}; 433# my $userValue = $userRecord->{$field};
434 my ($globalValue, $userValue) = ('', ''); 434 my ($globalValue, $userValue) = ('', '');
435 my $blankfield = ''; 435 my $blankfield = '';
436 if ( $field =~ /:/ ) { 436 if ( $field =~ /:/ ) {
437 my @gVals = ();
438 my @uVals = ();
439 my @bVals = ();
437 foreach my $f ( split(/:/, $field) ) { 440 foreach my $f ( split(/:/, $field) ) {
438 # hmm. this directly references the data in the 441 # hmm. this directly references the data in the
439 # record rather than calling the access method, 442 # record rather than calling the access method,
440 # thereby avoiding errors if the userRecord is 443 # thereby avoiding errors if the userRecord is
441 # undefined. that seems a bit suspect, but it's 444 # undefined. that seems a bit suspect, but it's
442 # used below so we'll leave it here. 445 # used below so we'll leave it here.
443 $globalValue .= $globalRecord->{$f} . ":"; 446
444 $userValue .= $userRecord->{$f} . ":"; 447 push(@gVals, $globalRecord->{$f} );
445 $blankfield .= ":"; 448 push(@uVals, $userRecord->{$f} ); # (defined($userRecord->{$f})?$userRecord->{$f}:'') );
449 push(@bVals, '');
446 } 450 }
447 $globalValue =~ s/:$//; 451 # I don't like this, but combining multiple values is a bit messy
448 $userValue =~ s/:$//; 452 $globalValue = (grep {defined($_)} @gVals) ? join(':', (map { defined($_) ? $_ : '' } @gVals )) : undef;
449 $blankfield =~ s/:$//; 453 $userValue = (grep {defined($_)} @uVals) ? join(':', (map { defined($_) ? $_ : '' } @uVals )) : undef;
454 $blankfield = join(':', @bVals);
450 } else { 455 } else {
451 $globalValue = $globalRecord->{$field}; 456 $globalValue = $globalRecord->{$field};
452 $userValue = $userRecord->{$field}; 457 $userValue = $userRecord->{$field};
453 } 458 }
454 459
455 # use defined instead of value in order to allow 0 to printed, e.g. for the 'value' field 460 # use defined instead of value in order to allow 0 to printed, e.g. for the 'value' field
456 $globalValue = (defined($globalValue)) ? ($labels{$globalValue || ""} || $globalValue) : ""; 461 $globalValue = (defined($globalValue)) ? ($labels{$globalValue || ""} || $globalValue) : "";
457 $userValue = (defined($userValue)) ? ($labels{$userValue || ""} || $userValue) : ""; 462 $userValue = (defined($userValue)) ? ($labels{$userValue || ""} || $userValue) : $blankfield;
458 463
459 if ($field =~ /_date/) { 464 if ($field =~ /_date/) {
460 $globalValue = $self->formatDateTime($globalValue) if defined $globalValue && $globalValue ne $labels{""}; 465 $globalValue = $self->formatDateTime($globalValue) if defined $globalValue && $globalValue ne $labels{""};
461 $userValue = $self->formatDateTime($userValue) if defined $userValue && $userValue ne $labels{""}; 466 $userValue = $self->formatDateTime($userValue) if defined $userValue && $userValue ne $labels{""};
462 } 467 }

Legend:
Removed from v.4929  
changed lines
  Added in v.4971

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9