Fix regex for internet bill and update splitBill since it's just lil Cammy now
authorCameron Ball <cameron@moodle.com>
Mon, 30 Dec 2019 06:22:29 +0000 (14:22 +0800)
committerCameron Ball <cameron@moodle.com>
Mon, 30 Dec 2019 06:22:29 +0000 (14:22 +0800)
src/common.php
src/rules.php

index fb00126..36e8f42 100644 (file)
@@ -54,7 +54,7 @@ function getTelegram(): TelegramAPI {
 }
 
 function splitBill(float $amount) : float {
-    return floor($amount/2);
+    return $amount;
 }
 
 function identity($x) {
index 10a2110..8f57393 100644 (file)
@@ -15,7 +15,7 @@ return [
     ],
     'Internet' => [
         'imapQuery' => 'FROM "@online.telstra.com"',
-        'regex' => '/Total \$(?<amount>[0-9]+(\.[0-9]{2})?).*?Due Date (?<due>\d{1,2} \w{3} \d{4})/',
+        'regex' => '/Total.*?\$(?<amount>[0-9]+(\.[0-9]{2})?).*?Due Date.*?(?<due>\d{1,2} \w{3} \d{4})/',
         'messageTransform' => ∘(glue(" "), map('trim'), lines, 'strip_tags', 'html_entity_decode')
     ],
     'Gas' => [