aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2016-11-19 15:51:22 +0100
committerJoris2016-11-19 15:51:22 +0100
commit293eb8295162bf0a038f488237db9c9d1316c04d (patch)
tree3e217f2f3dc127c574613bd8a2b56c8bb0816a74
parentede7b4fade5c396b47d386bd616e05805622b647 (diff)
Search payments with multiple words and by cost too
-rw-r--r--Makefile2
-rw-r--r--elm-package.json6
-rw-r--r--package.json7
-rw-r--r--src/client/elm/Model/Payment.elm8
4 files changed, 11 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index efbf48b..70c007a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ clean:
@rm -r elm-stuff >/dev/null 2>&1 || true
install:
- @elm package install
+ @elm package install --yes
# Watch
# -----
diff --git a/elm-package.json b/elm-package.json
index a65a9a2..f37c33b 100644
--- a/elm-package.json
+++ b/elm-package.json
@@ -12,10 +12,10 @@
"elm-lang/navigation": "1.0.0 <= v < 2.0.0",
"elm-lang/mouse": "1.0.0 <= v < 2.0.0",
"elm-lang/window": "1.0.0 <= v < 2.0.0",
+ "etaque/elm-simple-form": "3.0.1 <= v < 4.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0",
"evancz/url-parser": "1.0.0 <= v < 2.0.0",
- "etaque/elm-simple-form": "3.0.1 <= v < 4.0.0",
- "rluiten/elm-date-extra": "6.0.1 <= v < 7.0.0",
- "jystic/elm-font-awesome": "2.0.0 <= v < 3.0.0"
+ "jystic/elm-font-awesome": "2.0.0 <= v < 3.0.0",
+ "rluiten/elm-date-extra": "6.0.1 <= v < 7.0.0"
}
}
diff --git a/package.json b/package.json
deleted file mode 100644
index 6d7467e..0000000
--- a/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "dependencies": {
- "nodemon": "1.9.2"
- },
- "repository": "guyonvarch/sharedCost",
- "license": "GPL-3.0"
-}
diff --git a/src/client/elm/Model/Payment.elm b/src/client/elm/Model/Payment.elm
index b986148..5109b2f 100644
--- a/src/client/elm/Model/Payment.elm
+++ b/src/client/elm/Model/Payment.elm
@@ -20,6 +20,7 @@ import Date exposing (..)
import Date.Extra.Core exposing (monthToInt, intToMonth)
import Json.Decode as Json exposing ((:=))
import String
+import List
import Form.Validate as Validate exposing (Validation)
import Model.User exposing (UserId, userIdDecoder)
@@ -115,7 +116,12 @@ paymentSort frequency =
Monthly -> List.sortBy (String.toLower << .name)
searchSuccess : String -> Payment -> Bool
-searchSuccess text { name } = (String.toLower text) `String.contains` (String.toLower name)
+searchSuccess search { name, cost } =
+ let searchSuccessWord word =
+ ( String.contains (String.toLower word) (String.toLower name)
+ || String.contains word (toString cost)
+ )
+ in List.all searchSuccessWord (String.words search)
validateFrequency : Validation String Frequency
validateFrequency =