Skip to content

Commit

Permalink
QFix: add limit to count queries (#7458)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Savchenko <[email protected]>
  • Loading branch information
ArtyomSavchenko authored Dec 13, 2024
1 parent 5b1f0a6 commit a122f86
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
11 changes: 8 additions & 3 deletions plugins/document-resources/src/components/EditDoc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,14 @@
const starredQuery = createQuery()
let isStarred = false
$: starredQuery.query(document.class.SavedDocument, { attachedTo: _id }, (res) => {
isStarred = res.length !== 0
})
$: starredQuery.query(
document.class.SavedDocument,
{ attachedTo: _id },
(res) => {
isStarred = res.length !== 0
},
{ limit: 1 }
)
async function createEmbedding (file: File): Promise<{ file: Ref<Blob>, type: string } | undefined> {
if (doc === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
products.class.ProductVersion,
{ space: objectId },
(res) => {
versions = res.length
versions = res.total
},
{
total: true,
limit: 1,
projection: { _id: 1 }
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@
let applications: number
const query = createQuery()
$: query.query(recruit.class.Applicant, { space: objectId }, (res) => {
applications = res.length
})
$: query.query(
recruit.class.Applicant,
{ space: objectId },
(res) => {
applications = res.total
},
{ total: true, limit: 1 }
)
const createApp = (ev: MouseEvent): void => {
showPopup(CreateApplication, { space: objectId, preserveVacancy: true }, ev.target as HTMLElement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@
core.class.TypedSpace,
{ type: type._id },
(res) => {
spacesCount = res.length
spacesCount = res.total
loading = false
},
{
total: true,
limit: 1,
projection: { _id: 1 }
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@
task.class.Task,
{ kind: taskType._id },
(res) => {
tasksCounter = res.length
tasksCounter = res.total
},
{
total: true,
limit: 1,
projection: {
_id: 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
testManagement.class.TestCase,
query,
(res) => {
testCases = res.length
testCases = res.total
},
{ total: true, limit: 1 }
)
Expand Down

0 comments on commit a122f86

Please sign in to comment.