Merge pull request #342 from eikek/fix-save-existing-tag

Fix save existing tag
This commit is contained in:
mergify[bot] 2020-10-18 22:46:20 +00:00 committed by GitHub
commit b56a94f9eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -32,7 +32,7 @@ case class Column(name: String, ns: String = "", alias: String = "") {
def is[A: Put](ov: Option[A]): Fragment = def is[A: Put](ov: Option[A]): Fragment =
ov match { ov match {
case Some(v) => f ++ fr" = $v" case Some(v) => f ++ fr" = $v"
case None => fr"is null" case None => f ++ fr"is null"
} }
def is(c: Column): Fragment = def is(c: Column): Fragment =

View File

@ -69,7 +69,7 @@ object RTag {
val sql = selectCount( val sql = selectCount(
tid, tid,
table, table,
and(cid.is(tag.collective), name.is(tag.name), category.is(tag.category)) and(cid.is(tag.collective), name.is(tag.name))
) )
sql.query[Int].unique.map(_ > 0) sql.query[Int].unique.map(_ > 0)
} }

View File

@ -300,12 +300,20 @@ update flags msg model =
) )
SubmitResp (Ok res) -> SubmitResp (Ok res) ->
let
ret =
if res.success then
Just (makeValue model.form)
else
Nothing
in
( { model ( { model
| result = Just res | result = Just res
, submitting = False , submitting = False
} }
, Cmd.none , Cmd.none
, Just (makeValue model.form) , ret
) )
SubmitResp (Err err) -> SubmitResp (Err err) ->