mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 01:39:53 +00:00
Remove completed and canceled issues from the list (#2213)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
parent
0919892557
commit
8df9011bb0
@ -68,6 +68,9 @@
|
||||
$: selected = !Array.isArray(value) ? ('attachedTo' in value ? value.attachedTo : undefined) : undefined
|
||||
$: ignoreObjects = !Array.isArray(value) ? ('_id' in value ? [value._id] : []) : undefined
|
||||
$: docQuery = {
|
||||
'$lookup.status.category': {
|
||||
$nin: [tracker.issueStatusCategory.Completed, tracker.issueStatusCategory.Canceled]
|
||||
},
|
||||
'parents.parentId': {
|
||||
$nin: [
|
||||
...new Set(
|
||||
|
@ -96,7 +96,7 @@ abstract class MongoAdapterBase extends TxProcessor {
|
||||
for (const key in query) {
|
||||
const value = (query as any)[key]
|
||||
|
||||
const tkey = this.checkMixinKey(key, clazz)
|
||||
const tkey = this.translateKey(key, clazz)
|
||||
if (value !== null && typeof value === 'object') {
|
||||
const keys = Object.keys(value)
|
||||
if (keys[0] === '$like') {
|
||||
@ -321,25 +321,7 @@ abstract class MongoAdapterBase extends TxProcessor {
|
||||
if (options.sort !== undefined) {
|
||||
const sort = {} as any
|
||||
for (const _key in options.sort) {
|
||||
let key: string = _key
|
||||
const arr = key.split('.').filter((p) => p)
|
||||
key = ''
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const element = arr[i]
|
||||
if (element === '$lookup') {
|
||||
key += arr[++i] + '_lookup'
|
||||
} else {
|
||||
if (!key.endsWith('.') && i > 0) {
|
||||
key += '.'
|
||||
}
|
||||
key += arr[i]
|
||||
if (i !== arr.length - 1) {
|
||||
key += '.'
|
||||
}
|
||||
}
|
||||
// Check if key is belong to mixin class, we need to add prefix.
|
||||
key = this.checkMixinKey<T>(key, clazz)
|
||||
}
|
||||
const key: string = this.translateKey(_key, clazz)
|
||||
sort[key] = options.sort[_key] === SortingOrder.Ascending ? 1 : -1
|
||||
}
|
||||
pipeline.push({ $sort: sort })
|
||||
@ -378,6 +360,30 @@ abstract class MongoAdapterBase extends TxProcessor {
|
||||
return toFindResult(result, total)
|
||||
}
|
||||
|
||||
private translateKey<T extends Doc>(key: string, clazz: Ref<Class<T>>): string {
|
||||
const arr = key.split('.').filter((p) => p)
|
||||
let tKey = ''
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const element = arr[i]
|
||||
if (element === '$lookup') {
|
||||
tKey += arr[++i] + '_lookup'
|
||||
} else {
|
||||
if (!tKey.endsWith('.') && i > 0) {
|
||||
tKey += '.'
|
||||
}
|
||||
tKey += arr[i]
|
||||
if (i !== arr.length - 1) {
|
||||
tKey += '.'
|
||||
}
|
||||
}
|
||||
// Check if key is belong to mixin class, we need to add prefix.
|
||||
tKey = this.checkMixinKey<T>(tKey, clazz)
|
||||
}
|
||||
|
||||
return tKey
|
||||
}
|
||||
|
||||
private clearExtraLookups (row: any): void {
|
||||
for (const key in row) {
|
||||
if (key.endsWith('_lookup')) {
|
||||
|
Loading…
Reference in New Issue
Block a user