fix(services): counting trashed and archived items
This commit is contained in:
@@ -13,6 +13,10 @@ describe('ItemCounter', () => {
|
|||||||
{
|
{
|
||||||
trashed: true,
|
trashed: true,
|
||||||
} as jest.Mocked<SNNote>,
|
} as jest.Mocked<SNNote>,
|
||||||
|
{
|
||||||
|
archived: true,
|
||||||
|
trashed: true,
|
||||||
|
} as jest.Mocked<SNNote>,
|
||||||
{
|
{
|
||||||
content_type: ContentType.Note,
|
content_type: ContentType.Note,
|
||||||
} as jest.Mocked<SNNote>,
|
} as jest.Mocked<SNNote>,
|
||||||
@@ -23,7 +27,7 @@ describe('ItemCounter', () => {
|
|||||||
|
|
||||||
expect(createCounter().countNotesAndTags(items)).toEqual({
|
expect(createCounter().countNotesAndTags(items)).toEqual({
|
||||||
archived: 1,
|
archived: 1,
|
||||||
deleted: 1,
|
deleted: 2,
|
||||||
notes: 1,
|
notes: 1,
|
||||||
tags: 1,
|
tags: 1,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ export class ItemCounter implements ItemCounterInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
if (item.archived) {
|
if (item.trashed) {
|
||||||
counts.archived++
|
counts.deleted++
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (item.trashed) {
|
if (item.archived) {
|
||||||
counts.deleted++
|
counts.archived++
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user