|
@@ -374,7 +374,20 @@ object USDANodeNoId {
|
|
|
nutr.calories.map(amt => ("208", amt))
|
|
nutr.calories.map(amt => ("208", amt))
|
|
|
).flatten.toMap
|
|
).flatten.toMap
|
|
|
)
|
|
)
|
|
|
- case SurveyFoodItem(id, _, desc, _, _, _, _, _, _, port, _, _) => ???
|
|
|
|
|
|
|
+ case SurveyFoodItem(id, _, desc, _, _, _, _, _, _, port, _, _) => USDANodeNoId(
|
|
|
|
|
+ desc,
|
|
|
|
|
+ id,
|
|
|
|
|
+ getDefaultMeasure(port.map { (port) =>
|
|
|
|
|
+ val str = portionStr(port)
|
|
|
|
|
+ Measure(port, portionToMeasure(port, str), str)
|
|
|
|
|
+ }, VOLUME, None).map(_.conversion),
|
|
|
|
|
+ getDefaultMeasure(port.map { (port) =>
|
|
|
|
|
+ val str = portionStr(port)
|
|
|
|
|
+ Measure(port, portionToMeasure(port, str), str)
|
|
|
|
|
+ }, MASS, None).map(_.conversion),
|
|
|
|
|
+ 0.0f,
|
|
|
|
|
+ Map()
|
|
|
|
|
+ )
|
|
|
case SRLegacyFoodItem(id, _, dsc, _, _, _, _, _, _, nutr, _, _, _, port, _) =>
|
|
case SRLegacyFoodItem(id, _, dsc, _, _, _, _, _, _, nutr, _, _, _, port, _) =>
|
|
|
USDANodeNoId(
|
|
USDANodeNoId(
|
|
|
dsc,
|
|
dsc,
|
|
@@ -392,7 +405,14 @@ object USDANodeNoId {
|
|
|
.getOrElse(0.0f),
|
|
.getOrElse(0.0f),
|
|
|
nutr.flatMap(x => x.amount.map(amt => (x.nutrient.number, amt))).toMap
|
|
nutr.flatMap(x => x.amount.map(amt => (x.nutrient.number, amt))).toMap
|
|
|
)
|
|
)
|
|
|
- case SampleFoodItem(id, _, desc, _, _, _) => ???
|
|
|
|
|
|
|
+ case SampleFoodItem(id, _, desc, _, _, _) => USDANodeNoId(
|
|
|
|
|
+ desc,
|
|
|
|
|
+ id,
|
|
|
|
|
+ None,
|
|
|
|
|
+ None,
|
|
|
|
|
+ 0.0f,
|
|
|
|
|
+ Map()
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
implicit val config = JsonConfiguration(JsonNaming.SnakeCase)
|
|
implicit val config = JsonConfiguration(JsonNaming.SnakeCase)
|
|
@@ -445,7 +465,6 @@ object FoodNodeId {
|
|
|
(requ match {
|
|
(requ match {
|
|
|
case node: USDANodeId => Json.toJson(node)
|
|
case node: USDANodeId => Json.toJson(node)
|
|
|
case node: RecipeNodeId => Json.toJson(node)
|
|
case node: RecipeNodeId => Json.toJson(node)
|
|
|
- case node => println(node);???
|
|
|
|
|
}).asInstanceOf[JsObject] + (("node_type", Json.toJson(requ.nodeType)))
|
|
}).asInstanceOf[JsObject] + (("node_type", Json.toJson(requ.nodeType)))
|
|
|
)
|
|
)
|
|
|
|
|
|