From 4702fc69f66f941ff65c3d11032be145f9c51b9b Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Tue, 14 Feb 2012 11:09:41 -0500 Subject: [PATCH] Correct special winter handling in predictions The current serials prediction code has an exception for handling cases where 'Winter 2010' is followed by 'Spring 2010' rather than 'Spring 2011'. This exception assumed the more common case of a combined subfield $y, e.g.: $yps21,22,23,24 In doing so, it incorrectly handled less common cases where the $y is listed separately: $yps21$yps22$yps23$yps24 This change (with test data) ensures we only check the first $y for our 'early winter' exception. Signed-off-by: Dan Wells Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm | 9 +++++++-- Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhddata.txt | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm index d949b4e3f7..297d0ab661 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm @@ -540,8 +540,13 @@ sub winter_starts_year { if ($freq =~ /^\d$/) { foreach my $pubpat (@$pubpats) { my $chroncode = substr($pubpat, 0, 1); - if ($chroncode eq 's' and substr($pubpat, 1, 2) == 24) { - return 1; + if ($chroncode eq 's') { + # check first instance only + if (substr($pubpat, 1, 2) == 24) { + return 1; + } else { + return 0; + } } } } diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhddata.txt b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhddata.txt index 883bf3c246..162c621b56 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhddata.txt +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhddata.txt @@ -199,3 +199,9 @@ 853 20 $834$av.$bno.$u12$vr$i(year)$j(month)$wm$ycm12/01$yce22/3 863 41 $834.1$a24$b1$i2011$j11$x|a24|b2/3|i2011/2012|j12/01$zNov. to Combined Dec./Jan. 863 41 $834.2$a24$b2/3$i2011/2012$j12/1$x|a24|b4|i2012|j02$zCombined Dec./Jan. to Feb. + +# Winter does NOT start the calendar year, separate subfield 'y' +245 00 $aWinter does NOT start the calendar year, separate subfield 'y' +853 20 $835$av.$bno.$u4$vr$i(year)$j(season)$w4$yps21$yps22$yps23$yps24 +863 41 $835.1$a1$b4$i2010$j23$x|a2|b1|i2010|j24$zAutumn 2010 to Winter 2010 (separate 'y') +863 41 $835.2$a2$b1$i2010$j24$x|a2|b2|i2011|j21$zWinter 2010 to Spring 2011 (separate 'y') -- 2.11.0