Return classifier results as suggestions

This commit is contained in:
Eike Kettner 2021-01-19 23:13:51 +01:00
parent 75573c905e
commit 3ff9284a64

View File

@ -119,7 +119,7 @@ object QAttachment {
def getMetaProposals(itemId: Ident, coll: Ident): ConnectionIO[MetaProposalList] = { def getMetaProposals(itemId: Ident, coll: Ident): ConnectionIO[MetaProposalList] = {
val q = Select( val q = Select(
am.proposals.s, select(am.proposals, am.classifyProposals),
from(am) from(am)
.innerJoin(a, a.id === am.id) .innerJoin(a, a.id === am.id)
.innerJoin(item, a.itemId === item.id), .innerJoin(item, a.itemId === item.id),
@ -127,8 +127,15 @@ object QAttachment {
).build ).build
for { for {
ml <- q.query[MetaProposalList].to[Vector] ml <- q.query[(MetaProposalList, Option[MetaProposalList])].to[Vector]
} yield MetaProposalList.flatten(ml) pairs = ml.foldLeft(
(Vector.empty[MetaProposalList], Vector.empty[MetaProposalList])
) { case ((vl, vr), (m, o)) =>
(vl.appended(m), o.map(vr.appended).getOrElse(vr))
}
} yield MetaProposalList
.flatten(pairs._1)
.fillEmptyFrom(MetaProposalList.flatten(pairs._2))
} }
def getAttachmentMeta( def getAttachmentMeta(