OpenSRF::Utils::interval_to_seconds doesn't understand weeks or seconds

Bug #1474507 reported by Jason Etheridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenSRF
Fix Released
Medium
Unassigned

Bug Description

This was discovered when testing the library setting "Checkout auto renew age" in Evergreen.

opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 second") . "\n";'
0
opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 minute") . "\n";'
60
opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 hour") . "\n";'
3600
opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 day") . "\n";'
86400
opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 week") . "\n";'
0
opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 month") . "\n";'
2628000
opensrf@dev141:~/git/OpenSRF (master)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 year") . "\n";'
31536000

Tags: pullrequest
Revision history for this message
Jason Etheridge (phasefx) wrote :

http://git.evergreen-ils.org/?p=working/OpenSRF.git;a=shortlog;h=refs/heads/collab/phasefx/interval_to_seconds

opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::inte
rval_to_seconds("1 second") . "\n";'
1
opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::inte
rval_to_seconds("1 minute") . "\n";'
60
opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::inte
rval_to_seconds("1 hour") . "\n";'
3600
opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 day") . "\n";'
86400
opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 week") . "\n";'
604800
opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 month") . "\n";'
2628000
opensrf@dev141:~/git/OpenSRF (interval_to_seconds)$ perl -MOpenSRF::Utils -e 'print OpenSRF::Utils::interval_to_seconds("1 year") . "\n";'
31536000

tags: added: pullrequest
Revision history for this message
Erica Rohlfs (erohlfs) wrote :

Confirmed on version 2.8.1.

For Library Setting: Checkout auto renew age, defining the value in seconds or weeks does not produce the expected results.

Changed in opensrf:
status: New → Confirmed
Revision history for this message
Jason Etheridge (phasefx) wrote :

pushed an extra commit for tests

opensrf@dev141:~/git/OpenSRF/src/perl (interval_to_seconds)$ prove t/09-Utils-interval_to_seconds.t
t/09-Utils-interval_to_seconds.t .. ok
All tests successful.
Files=1, Tests=9, 0 wallclock secs ( 0.03 usr 0.02 sys + 0.15 cusr 0.03 csys = 0.23 CPU)
Result: PASS

Revision history for this message
Galen Charlton (gmc) wrote :

Pushed to master and rel_2_4. Thanks, Jason!

Changed in opensrf:
status: Confirmed → Fix Committed
Changed in opensrf:
milestone: none → 2.4.2
importance: Undecided → Medium
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.