From 087595ee756f8c413b8c5d337938959c2b555819 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 6 Jun 2019 14:22:40 -0500 Subject: [PATCH] Store null if requestor/subject is not entered (#12) The output was fine; the form was parsing `Some ""` instead of `None` as the code was expecting --- src/PrayerTracker/PrayerRequest.fs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PrayerTracker/PrayerRequest.fs b/src/PrayerTracker/PrayerRequest.fs index aaf638f..af7fe2f 100644 --- a/src/PrayerTracker/PrayerRequest.fs +++ b/src/PrayerTracker/PrayerRequest.fs @@ -261,8 +261,7 @@ let save : HttpHandler = >=> validateCSRF >=> fun next ctx -> task { - let! result = ctx.TryBindFormAsync () - match result with + match! ctx.TryBindFormAsync () with | Ok m -> let db = ctx.dbContext () let! req = @@ -274,7 +273,7 @@ let save : HttpHandler = let upd8 = { pr with requestType = PrayerRequestType.fromCode m.requestType - requestor = m.requestor + requestor = match m.requestor with Some x when x.Trim () = "" -> None | x -> x text = ckEditorToText m.text expiration = Expiration.fromCode m.expiration }