mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 17:55:06 +00:00
Merge pull request #342 from eikek/fix-save-existing-tag
Fix save existing tag
This commit is contained in:
commit
b56a94f9eb
@ -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 =
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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) ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user