Skip to content

Commit

Permalink
Vær forsiktig med å hente gram næringsstoff som kan være nil
Browse files Browse the repository at this point in the history
  • Loading branch information
cjohansen committed Oct 23, 2023
1 parent a3367c0 commit 24d968e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/matvaretabellen/pages/food_page.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
[mt-designsystem.components.site-header :refer [SiteHeader]]))

(defn get-nutrient-grams [food id]
(->> (:food/constituents food)
(filter (comp #{id} :nutrient/id :constituent/nutrient))
first
:measurement/quantity
b/num))
(some->> (:food/constituents food)
(filter (comp #{id} :nutrient/id :constituent/nutrient))
first
:measurement/quantity
b/num))

(defn get-nutrient-parts [food nutrient-id]
(->> (:food/constituents food)
Expand Down

0 comments on commit 24d968e

Please sign in to comment.