From dbac13b844ce6187d6b5c0b7b2c5bea86ba4c85d Mon Sep 17 00:00:00 2001 From: Tomasz Malisiewicz Date: Fri, 4 Sep 2015 19:20:38 -0400 Subject: [PATCH] add two new params --- Handler/EditModel.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Handler/EditModel.hs b/Handler/EditModel.hs index da85c55..f2627c0 100644 --- a/Handler/EditModel.hs +++ b/Handler/EditModel.hs @@ -10,17 +10,19 @@ data VMXEditSettings = VMXEditSettings { vmxESmax_negatives :: Maybe Integer, vmxESpositives_order :: Maybe Integer, vmxESnegatives_order :: Maybe Integer, - vmxESpad_scale :: Maybe Float + vmxESpad_scale :: Maybe Float, + vmxESimage_size :: Maybe Integer } instance ToJSON VMXEditSettings where - toJSON (VMXEditSettings lp maxp maxn po no ps) = + toJSON (VMXEditSettings lp maxp maxn po no ps is) = object ["learn_iterations" .= fromMaybe 0 lp, "max_positives" .= fromMaybe 20 maxp, "max_negatives" .= fromMaybe 20 maxn, "positives_order" .= fromMaybe 1 po, "negatives_order" .= fromMaybe (-1) no, - "pad_scale" .= fromMaybe (1.0) ps] + "pad_scale" .= fromMaybe (1.0) ps, + "image_size" .= fromMaybe (100) is] instance FromJSON VMXEditSettings where parseJSON (Object o) = @@ -30,6 +32,7 @@ instance FromJSON VMXEditSettings where <*> (o .:? "positives_order") <*> (o .:? "negatives_order") <*> (o .:? "pad_scale") + <*> (o .:? "image_size") parseJSON _ = mzero @@ -75,7 +78,6 @@ instance FromJSON EditModelCommand where genericEditModel :: SessionId -> String -> Handler TypedContent genericEditModel sid command = do - --addHeader "Content-Type" "application/json" (r :: EditModelCommand) <- requireJsonBody let req = object [ "command" .= command , "settings" .= (editModelSettings r)