From 4baa57dbde57a2154b678abf9c0d96b8c4dc9546 Mon Sep 17 00:00:00 2001 From: akintolga Date: Sun, 3 Jul 2016 12:22:59 +1000 Subject: [PATCH] Date format and the usd macro fix for 000 --- client/app/index.html | 7 +++++++ server/aap/macros/currency_usd_to_aud.py | 2 +- server/aap/macros/currency_usd_to_aud_test.py | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/app/index.html b/client/app/index.html index 108da890d..1d329cf90 100644 --- a/client/app/index.html +++ b/client/app/index.html @@ -248,6 +248,13 @@ embeds: false }; + config.view = { + timeformat: 'HH:mm', + dateformat: 'DD/MM/YYYY' + }; + + config.defaultTimezone = 'Australia/Sydney'; + config.list = { 'priority': [ 'priority', diff --git a/server/aap/macros/currency_usd_to_aud.py b/server/aap/macros/currency_usd_to_aud.py index 6dca8eb99..af18aa1bb 100644 --- a/server/aap/macros/currency_usd_to_aud.py +++ b/server/aap/macros/currency_usd_to_aud.py @@ -31,7 +31,7 @@ def usd_to_aud(item, **kwargs): if os.environ.get('BEHAVE_TESTING'): rate = USD_TO_AUD - regex = r'((\$US)|(\$)|(USD)|(\$US))\s*\-?\s*\(?(((\d{1,3}((\,\d{3})*|\d*))?' \ + regex = r'((\$US)|(\$)|(USD)|(\$US))\s*\-?\s*\(?(((\d{1,4}((\,\d{3})*|\d*))?' \ r'(\.\d{1,4})?)|((\d{1,3}((\,\d{3})*|\d*))(\.\d{0,4})?))\)?' \ + currency_base.SUFFIX_REGEX diff --git a/server/aap/macros/currency_usd_to_aud_test.py b/server/aap/macros/currency_usd_to_aud_test.py index f6f91154f..d4e310650 100644 --- a/server/aap/macros/currency_usd_to_aud_test.py +++ b/server/aap/macros/currency_usd_to_aud_test.py @@ -17,6 +17,7 @@ class CurrencyTestCase(unittest.TestCase): def test_usd_to_aud(self): text = 'This is a $ 40 note. ' \ + 'This is a $ 1000 note. ' \ 'This is a $41 note. ' \ 'This is a $(42) note. ' \ 'This is a $46,483 note. ' \ @@ -46,6 +47,7 @@ def test_usd_to_aud(self): item = {'body_html': text} res, diff = usd_to_aud(item, rate=Decimal(2)) self.assertEqual(diff['$ 40'], '$ 40 ($A80)') + self.assertEqual(diff['$ 1000'], '$ 1000 ($A2,000)') self.assertEqual(diff['$41'], '$41 ($A82)') self.assertEqual(diff['$(42)'], '$(42) ($A84)') self.assertEqual(diff['$46,483'], '$46,483 ($A92,966)')