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
This commit is contained in:
Daniel J. Summers 2019-06-06 14:22:40 -05:00
parent 43b6b6d8e0
commit 087595ee75

View File

@ -261,8 +261,7 @@ let save : HttpHandler =
>=> validateCSRF >=> validateCSRF
>=> fun next ctx -> >=> fun next ctx ->
task { task {
let! result = ctx.TryBindFormAsync<EditRequest> () match! ctx.TryBindFormAsync<EditRequest> () with
match result with
| Ok m -> | Ok m ->
let db = ctx.dbContext () let db = ctx.dbContext ()
let! req = let! req =
@ -274,7 +273,7 @@ let save : HttpHandler =
let upd8 = let upd8 =
{ pr with { pr with
requestType = PrayerRequestType.fromCode m.requestType 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 text = ckEditorToText m.text
expiration = Expiration.fromCode m.expiration expiration = Expiration.fromCode m.expiration
} }