Merge pull request #291 from sharelatex/bg-fix-project-get-exclusion

fix typo in project getter exclusions
This commit is contained in:
Brian Gough 2018-01-31 11:51:01 +00:00 committed by GitHub
commit c19acd82a4
2 changed files with 38 additions and 38 deletions

View file

@ -13,15 +13,15 @@ module.exports = ProjectGetter =
getProjectWithoutDocLines: (project_id, callback=(error, project) ->) ->
excludes = {}
for i in [1..ProjectGetter.EXCLUDE_DEPTH]
excludes["rootFolder#{Array(i).join(".folder")}.docs.lines"] = 0
excludes["rootFolder#{Array(i).join(".folders")}.docs.lines"] = 0
db.projects.find _id: ObjectId(project_id.toString()), excludes, (error, projects = []) ->
callback error, projects[0]
getProjectWithOnlyFolders: (project_id, callback=(error, project) ->) ->
excludes = {}
for i in [1..ProjectGetter.EXCLUDE_DEPTH]
excludes["rootFolder#{Array(i).join(".folder")}.docs"] = 0
excludes["rootFolder#{Array(i).join(".folder")}.fileRefs"] = 0
excludes["rootFolder#{Array(i).join(".folders")}.docs"] = 0
excludes["rootFolder#{Array(i).join(".folders")}.fileRefs"] = 0
db.projects.find _id: ObjectId(project_id.toString()), excludes, (error, projects = []) ->
callback error, projects[0]

View file

@ -41,13 +41,13 @@ describe "ProjectGetter", ->
it "should exclude the doc lines", ->
excludes =
"rootFolder.docs.lines": 0
"rootFolder.folder.docs.lines": 0
"rootFolder.folder.folder.docs.lines": 0
"rootFolder.folder.folder.folder.docs.lines": 0
"rootFolder.folder.folder.folder.folder.docs.lines": 0
"rootFolder.folder.folder.folder.folder.folder.docs.lines": 0
"rootFolder.folder.folder.folder.folder.folder.folder.docs.lines": 0
"rootFolder.folder.folder.folder.folder.folder.folder.folder.docs.lines": 0
"rootFolder.folders.docs.lines": 0
"rootFolder.folders.folders.docs.lines": 0
"rootFolder.folders.folders.folders.docs.lines": 0
"rootFolder.folders.folders.folders.folders.docs.lines": 0
"rootFolder.folders.folders.folders.folders.folders.docs.lines": 0
"rootFolder.folders.folders.folders.folders.folders.folders.docs.lines": 0
"rootFolder.folders.folders.folders.folders.folders.folders.folders.docs.lines": 0
@db.projects.find.calledWith(sinon.match.any, excludes)
.should.equal true
@ -75,20 +75,20 @@ describe "ProjectGetter", ->
excludes =
"rootFolder.docs": 0
"rootFolder.fileRefs": 0
"rootFolder.folder.docs": 0
"rootFolder.folder.fileRefs": 0
"rootFolder.folder.folder.docs": 0
"rootFolder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folders.docs": 0
"rootFolder.folders.fileRefs": 0
"rootFolder.folders.folders.docs": 0
"rootFolder.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.folders.fileRefs": 0
@db.projects.find.calledWith(sinon.match.any, excludes).should.equal true
it "should call the callback with the project", ->
@ -115,20 +115,20 @@ describe "ProjectGetter", ->
excludes =
"rootFolder.docs": 0
"rootFolder.fileRefs": 0
"rootFolder.folder.docs": 0
"rootFolder.folder.fileRefs": 0
"rootFolder.folder.folder.docs": 0
"rootFolder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.folder.docs": 0
"rootFolder.folder.folder.folder.folder.folder.folder.folder.fileRefs": 0
"rootFolder.folders.docs": 0
"rootFolder.folders.fileRefs": 0
"rootFolder.folders.folders.docs": 0
"rootFolder.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.fileRefs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.folders.docs": 0
"rootFolder.folders.folders.folders.folders.folders.folders.folders.fileRefs": 0
@db.projects.find.calledWith(sinon.match.any, excludes).should.equal true
it "should call the callback with the project", ->