Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from amos-ws16/dev
Sprint 10 Release
- Loading branch information
Showing
11 changed files
with
166 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* | ||
* @param user - an username which indicates the user who uploaded the file | ||
* @param assignee - a list of names of the assignees of the tasks | ||
* @return array with objects with the key ´assignees´ and the score of 1.0 if the user is found in the specific task or 0.0 if not found | ||
*/ | ||
function isAssigneePlugin (user, task) { | ||
let found = false | ||
let result = [] | ||
for (let x of task) { | ||
for (let y of x.assignees) { | ||
if (y === user) { | ||
found = true | ||
break | ||
} | ||
} | ||
if (found) { | ||
result.push({'assignees': 1.0}) | ||
} else { | ||
result.push({'assignees': 0.0}) | ||
} | ||
} | ||
return result | ||
} | ||
|
||
module.exports = isAssigneePlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const buster = require('buster') | ||
const plugin = require('../../lib/plugins/is-assignee-plugin.js') | ||
|
||
buster.testCase('isAssigneePlugin', { | ||
'Testcase 1: 2 tasks with 2 assignees each': function () { | ||
let user = 'a' | ||
let task = [{'assignees': ['b', 'c']}, {'assignees': ['a', 'c']}] | ||
let testResult = [{'assignees': 0.0}, {'assignees': 1.0}] | ||
let result = plugin(user, task) | ||
buster.assert.equals(result, testResult) | ||
}, | ||
|
||
'Testcase 2: 2 tasks with 1 assignee each': function () { | ||
let user = 'a' | ||
let task = [{'assignees': ['b']}, {'assignees': ['a']}] | ||
let testResult = [{'assignees': 0.0}, {'assignees': 1.0}] | ||
let result = plugin(user, task) | ||
buster.assert.equals(result, testResult) | ||
}, | ||
|
||
'Testcase 3: no tasks': function () { | ||
let user = 'a' | ||
let task = [] | ||
let testResult = [] | ||
let result = plugin(user, task) | ||
buster.assert.equals(result, testResult) | ||
}, | ||
'Testcase 4: ': function () { | ||
let user = 'a' | ||
let task = [{'assignees': ['b', 'c']}, {'assignees': ['a']}] | ||
let testResult = [{'assignees': 0.0}, {'assignees': 1.0}] | ||
let result = plugin(user, task) | ||
buster.assert.equals(result, testResult) | ||
}, | ||
'Testcase 5: ': function () { | ||
let user = 'a' | ||
let task = [{'assignees': ['b']}, {'assignees': ['a', 'c']}] | ||
let testResult = [{'assignees': 0.0}, {'assignees': 1.0}] | ||
let result = plugin(user, task) | ||
buster.assert.equals(result, testResult) | ||
} | ||
}) |