mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TSK-1574: Accurate time reports count (#3509)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
3fcd9081be
commit
046de0d986
@ -799,7 +799,7 @@ export class LiveQuery extends TxProcessor implements Client {
|
||||
}
|
||||
|
||||
if (q.options?.limit !== undefined && q.result.length > q.options.limit) {
|
||||
if (q.result.pop()?._id !== doc._id) {
|
||||
if (q.result.pop()?._id !== doc._id || q.options?.total === true) {
|
||||
await this.callback(q)
|
||||
}
|
||||
} else {
|
||||
|
@ -226,7 +226,7 @@
|
||||
_class,
|
||||
totalQuery ?? query ?? {},
|
||||
(result) => {
|
||||
gtotal = result.total
|
||||
gtotal = result.total === -1 ? 0 : result.total
|
||||
},
|
||||
{
|
||||
lookup,
|
||||
|
@ -424,7 +424,7 @@ abstract class MongoAdapterBase implements DbAdapter {
|
||||
cursor.maxTimeMS(30000)
|
||||
const res = (await cursor.toArray())[0]
|
||||
const result = res.results as WithLookup<T>[]
|
||||
const total = res.totalCount?.shift()?.count ?? -1
|
||||
const total = options?.total === true ? res.totalCount?.shift()?.count ?? 0 : -1
|
||||
for (const row of result) {
|
||||
await this.fillLookupValue(clazz, options?.lookup, row)
|
||||
this.clearExtraLookups(row)
|
||||
|
@ -172,6 +172,39 @@ test('report-time-from-issue-card', async ({ page }) => {
|
||||
}
|
||||
})
|
||||
|
||||
test('report-multiple-time-from-issue-card', async ({ page }) => {
|
||||
await navigate(page)
|
||||
const assignee = 'Chen Rosamund'
|
||||
const status = 'In Progress'
|
||||
const time = 0.25
|
||||
|
||||
const name = getIssueName()
|
||||
|
||||
try {
|
||||
await page.evaluate(() => localStorage.setItem('#platform.notification.timeout', '5000'))
|
||||
await createIssue(page, { name, assignee, status })
|
||||
await page.waitForSelector(`text="${name}"`)
|
||||
await page.waitForSelector('text="View issue"')
|
||||
await page.click('text="View issue"')
|
||||
} finally {
|
||||
await page.evaluate(() => localStorage.setItem('#platform.notification.timeout', '0'))
|
||||
}
|
||||
|
||||
await page.click('#ReportedTimeEditor')
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i}`)
|
||||
await page.waitForSelector('text="Time spend reports"')
|
||||
await page.click('#ReportsPopupAddButton')
|
||||
await page.waitForSelector('text="Add time report"')
|
||||
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
|
||||
await page.fill('[placeholder="Reported\\ days"]', `${time}`)
|
||||
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
|
||||
await page.click('button:has-text("Create")')
|
||||
await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i + 1}`)
|
||||
}
|
||||
})
|
||||
|
||||
test('report-time-from-main-view', async ({ page }) => {
|
||||
await navigate(page)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user