| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/DB.pm,v 1.48 2004/06/14 22:58:55 sh002i Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/DB.pm,v 1.49 2004/06/15 18:55:26 sh002i Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 1712 | my $UserSet = $UserSets[$i]; |
1712 | my $UserSet = $UserSets[$i]; |
| 1713 | my $GlobalSet = $GlobalSets[$i]; |
1713 | my $GlobalSet = $GlobalSets[$i]; |
| 1714 | next unless defined $UserSet and defined $GlobalSet; |
1714 | next unless defined $UserSet and defined $GlobalSet; |
| 1715 | foreach my $field (@commonFields) { |
1715 | foreach my $field (@commonFields) { |
| 1716 | #next if defined $UserSet->$field; |
1716 | #next if defined $UserSet->$field; |
| 1717 | # ok, now we're testing for emptiness instead of definedness. |
1717 | # ok, now we're testing for emptiness as well as definedness. |
| 1718 | next if $UserSet->$field ne ""; |
1718 | next if defined $UserSet->$field and $UserSet->$field ne ""; |
| 1719 | $UserSet->$field($GlobalSet->$field); |
1719 | $UserSet->$field($GlobalSet->$field); |
| 1720 | } |
1720 | } |
| 1721 | } |
1721 | } |
| 1722 | $WeBWorK::timer->continue("DB: merge done!") if defined($WeBWorK::timer); |
1722 | $WeBWorK::timer->continue("DB: merge done!") if defined($WeBWorK::timer); |
| 1723 | |
1723 | |
| … | |
… | |
| 1815 | foreach my $field (@commonFields) { |
1815 | foreach my $field (@commonFields) { |
| 1816 | # FIXME: WW1Hash upgrades undefined fileds to "" when creating record objects |
1816 | # FIXME: WW1Hash upgrades undefined fileds to "" when creating record objects |
| 1817 | # Shouldn't we be testing for emptiness rather than definedness? |
1817 | # Shouldn't we be testing for emptiness rather than definedness? |
| 1818 | # I think the spec says that if a field is EMPTY the global value is used. |
1818 | # I think the spec says that if a field is EMPTY the global value is used. |
| 1819 | #next if defined $UserProblem->$field; |
1819 | #next if defined $UserProblem->$field; |
| 1820 | # ok, now we're testing for emptiness instead of definedness. |
1820 | # ok, now we're testing for emptiness as well as definedness. |
| 1821 | next if $UserProblem->$field ne ""; |
1821 | next if defined $UserProblem->$field and $UserProblem->$field ne ""; |
| 1822 | $UserProblem->$field($GlobalProblem->$field); |
1822 | $UserProblem->$field($GlobalProblem->$field); |
| 1823 | } |
1823 | } |
| 1824 | } |
1824 | } |
| 1825 | $WeBWorK::timer->continue("DB: merge done!") if defined($WeBWorK::timer); |
1825 | $WeBWorK::timer->continue("DB: merge done!") if defined($WeBWorK::timer); |
| 1826 | |
1826 | |