From 6a3386ce66db1cbcc83c161739b907f11f6dc1f9 Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Mon, 19 Oct 2020 00:29:41 +0200 Subject: [PATCH 1/3] Fix sql comparison with optional values --- modules/store/src/main/scala/docspell/store/impl/Column.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/store/src/main/scala/docspell/store/impl/Column.scala b/modules/store/src/main/scala/docspell/store/impl/Column.scala index 2357664b..87253163 100644 --- a/modules/store/src/main/scala/docspell/store/impl/Column.scala +++ b/modules/store/src/main/scala/docspell/store/impl/Column.scala @@ -32,7 +32,7 @@ case class Column(name: String, ns: String = "", alias: String = "") { def is[A: Put](ov: Option[A]): Fragment = ov match { case Some(v) => f ++ fr" = $v" - case None => fr"is null" + case None => f ++ fr"is null" } def is(c: Column): Fragment = From 3771587e55fcc7aa99454780b05f936566b46cf1 Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Mon, 19 Oct 2020 00:29:53 +0200 Subject: [PATCH 2/3] Find duplicate tags without category --- modules/store/src/main/scala/docspell/store/records/RTag.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/store/src/main/scala/docspell/store/records/RTag.scala b/modules/store/src/main/scala/docspell/store/records/RTag.scala index 71b7b1f0..e0c1a56a 100644 --- a/modules/store/src/main/scala/docspell/store/records/RTag.scala +++ b/modules/store/src/main/scala/docspell/store/records/RTag.scala @@ -69,7 +69,7 @@ object RTag { val sql = selectCount( tid, 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) } From d66ae4fdc23a9247aa2874fc7a4f063a64fec54b Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Mon, 19 Oct 2020 00:30:21 +0200 Subject: [PATCH 3/3] Display error message properly on modal edit --- modules/webapp/src/main/elm/Comp/DetailEdit.elm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/webapp/src/main/elm/Comp/DetailEdit.elm b/modules/webapp/src/main/elm/Comp/DetailEdit.elm index 12efb8a4..5330da9c 100644 --- a/modules/webapp/src/main/elm/Comp/DetailEdit.elm +++ b/modules/webapp/src/main/elm/Comp/DetailEdit.elm @@ -300,12 +300,20 @@ update flags msg model = ) SubmitResp (Ok res) -> + let + ret = + if res.success then + Just (makeValue model.form) + + else + Nothing + in ( { model | result = Just res , submitting = False } , Cmd.none - , Just (makeValue model.form) + , ret ) SubmitResp (Err err) ->