Skip to content

Commit

Permalink
Add edit snyppets to lock editing
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Aug 29, 2024
1 parent 61a1b05 commit c887952
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions scilog/src/app/core/remote-data.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion scilog/src/app/core/remote-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c887952

Please sign in to comment.