Skip to content

Commit

Permalink
Use lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
mukkachaitanya committed Aug 31, 2017
1 parent d479a8b commit cde15f6
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions eval_teamwise/eval_teamwise.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,18 @@ var computeTeamResults = function(args, logger=console) {
* teamNumber : [Students of the team],
* }
*/
var teamView = {};
var teamView = _.transform(teams, function (result, team) {
(result[team[1]] || (result[team[1]] = [])).push(team[0])
}, {})

// creates the object of the above form from teams array
teams.map(function(tuple) {
if (!teamView.hasOwnProperty(tuple[1])) teamView[tuple[1]] = [];
teamView[tuple[1]].push(tuple[0]);
});


/* marksView Object of the form:
/* marksView Object of the form:
* {
* studentID : int(score),
* }
*/
var marksView = {};
// creates the object of the above from from teams array

var marksView = _.fromPairs(marks)

// creates the object of the above from from teams array
marks.map(function(tup) {
Expand Down

0 comments on commit cde15f6

Please sign in to comment.