diff --git a/scilog/src/app/core/remote-data.service.spec.ts b/scilog/src/app/core/remote-data.service.spec.ts index d071a939..0f87662c 100644 --- a/scilog/src/app/core/remote-data.service.spec.ts +++ b/scilog/src/app/core/remote-data.service.spec.ts @@ -131,9 +131,12 @@ describe('LogbookItemDataService', () => { relation: 'subsnippets', scope: { - where: {and: [ - {tags: {inq: ['a', 'b']}}, - {tags: {nin: ['c', 'd']}} + where: {or: [ + {snippetType: 'edit'}, + {and: [ + {tags: {inq: ['a', 'b']}}, + {tags: {nin: ['c', 'd']}} + ]}, ]}, include: [{ relation: 'subsnippets', @@ -246,15 +249,15 @@ describe('LogbookItemDataService', () => { }, { input: {tags: ['a', 'b'], excludeTags: ['c', 'd']}, - expected: {scope:{include:[{relation:'subsnippets',scope:{where:{snippetType:'edit'}}}],where:{and:[{tags:{inq:['a','b']}},{tags:{nin:['c','d']}}]}}} + expected: {scope:{include:[{relation:'subsnippets',scope:{where:{snippetType:'edit'}}}],where:{or:[{snippetType: 'edit'},{and:[{tags:{inq:['a','b']}},{tags:{nin:['c','d']}}]}]}}} }, { input: {tags: ['a', 'b']}, - expected: {scope:{include:[{relation:'subsnippets',scope:{where:{snippetType:'edit'}}}],where:{and:[{tags:{inq:['a','b']}}]}}} + expected: {scope:{include:[{relation:'subsnippets',scope:{where:{snippetType:'edit'}}}],where:{or:[{snippetType: 'edit'},{and:[{tags:{inq:['a','b']}}]}]}}} }, { input: {excludeTags: ['c', 'd']}, - expected: {scope:{include:[{relation:'subsnippets',scope:{where:{snippetType:'edit'}}}],where:{and:[{tags:{nin:['c','d']}}]}}} + expected: {scope:{include:[{relation:'subsnippets',scope:{where:{snippetType:'edit'}}}],where:{or:[{snippetType: 'edit'},{and:[{tags:{nin:['c','d']}}]}]}}} } ] .forEach((t, i) => { diff --git a/scilog/src/app/core/remote-data.service.ts b/scilog/src/app/core/remote-data.service.ts index bde67b04..5a2ef1a5 100644 --- a/scilog/src/app/core/remote-data.service.ts +++ b/scilog/src/app/core/remote-data.service.ts @@ -163,7 +163,7 @@ export class LogbookItemDataService extends RemoteDataService { const tags = this.tagsFilter(configFilter); if (tags.length === 0) return scope; - scope.scope.where = {and: tags}; + scope.scope.where = {or: [{snippetType: 'edit'}, {and: tags}]} return scope; }