Kevin Wetzels avatar Kevin Wetzels committed e4b9a07

Fix error in MinutesWidget rendering 60 as 0:60 instead of 1:00

Comments (0)

Files changed (3)

 
 setup(
     name='django-stdfields',
-    version='0.0.10',
+    version='1.0.0',
     author=u'Kevin Wetzels',
     author_email=u'kevin@roam.be',
     url='https://bitbucket.org/roam/django-stdfields',

stdfields/tests.py

         tpl = '<input type="text" name="hi" value="%s" />'
         self.assertEqual(w.render('hi', '121'), tpl % '2:01')
         self.assertEqual(w.render('hi', '2:1'), tpl % '2:1')
+        self.assertEqual(w.render('hi', 60), tpl % '1:00')
         self.assertEqual(w.render('hi', '2:60'), tpl % '2:60')
         self.assertEqual(w.render('hi', '493'), tpl % '8:13')
 

stdfields/widgets.py

     def divide(cls, total):
         if total <= 0:
             return (0, 0)
-        hours = 0 if total <= 60 else total / 60
+        hours = 0 if total < 60 else total / 60
         return (hours, total - (hours * 60))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.