Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Feature/sup 2899 #643

Merged
merged 5 commits into from
Jan 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/index.jade
Original file line number Diff line number Diff line change
@@ -154,6 +154,8 @@ html
script(src='../bower_components/react/react.js')
script(src='../bower_components/react/react-dom.js')
script(src='../bower_components/classnames/index.js')
script(src='../bower_components/classnames/bind.js')
script(src='../bower_components/classnames/dedupe.js')
script(src='../bower_components/react-input-autosize/dist/react-input-autosize.min.js')
script(src='../bower_components/react-select/dist/react-select.min.js')
script(src='../bower_components/ngReact/ngReact.js')
2 changes: 1 addition & 1 deletion app/profile/subtrack/subtrack.controller.js
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@
var reliability = vm.subTrackStats.filter(function(stat) { return stat.label === 'reliability'; });
if (reliability.length > 0) {
reliability = reliability[0];
reliability.link = 'http://community.' + vm.domain + '/tc?module=ReliabilityDetail&pt=2&cr=' + profileVm.profile.userId;
reliability.link = 'http://community.' + vm.domain + '/tc?module=ReliabilityDetail&pt=' + UserStatsService.mapReliability(vm.subTrack) + '&cr=' + profileVm.profile.userId;
}
var mustHaveMetrics = ["rank", "rating", "reliability"];
// check if rating, rank & reliability are all set
47 changes: 45 additions & 2 deletions app/services/userStats.service.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,8 @@
processStats: processStats,
compileSubtracks: compileSubtracks,
filterStats: filterStats,
processStatRank: processStatRank
processStatRank: processStatRank,
mapReliability: mapReliability
};

var percentageFunc = function(n) { return $filter('percentage')(n);};
@@ -160,7 +161,49 @@
return filtered;
}


function mapReliability(subTrack) {
var reliabilityMapping = {
'DESIGN': 1,
'DEVELOPMENT': 1,
'TESTING_COMPETITION': 1,
'SPECIFICATION': 2,
'ARCHITECTURE': 2,
'COMPONENT_PRODUCTION': 2,
'BUG_HUNT': 2,
'DEPLOYMENT': 2,
'SECURITY': 2,
'PROCESS': 2,
'TEST_SUITES': 2,
'ASSEMBLY_COMPETITION': 2,
'LEGACY': 2,
'BANNERS_OR_ICONS': 3,
'WEB_DESIGN': 3,
'WIREFRAMES': 3,
'UI_PROTOTYPE_COMPETITION': 2,
'LOGO_DESIGN': 3,
'PRINT_OR_PRESENTATION': 3,
'CONCEPTUALIZATION': 2,
'RIA_BUILD_COMPETITION': 2,
'RIA_COMPONENT_COMPETITION': 2,
'TEST_SCENARIOS': 2,
'SPEC_REVIEW': 2,
'GENERIC_SCORECARDS': 4,
'COPILOT_POSTING': 2,
'CONTENT_CREATION': 2,
'WIDGET_OR_MOBILE_SCREEN_DESIGN': 3,
'FRONT_END_FLASH': 3,
'APPLICATION_FRONT_END_DESIGN': 3,
'STUDIO_OTHER': 3,
'IDEA_GENERATION': 3,
'REPORTING': 2,
'MARATHON_MATCH': 2,
'FIRST_2_FINISH': 2,
'CODE': 2,
'DESIGN_FIRST_2_FINISH': 3
};

return reliabilityMapping[subTrack] || 2;
}
}

})();
55 changes: 55 additions & 0 deletions app/services/userStats.service.spec.js
Original file line number Diff line number Diff line change
@@ -382,5 +382,60 @@ describe('User Stats Service', function() {
});
});

describe('mapReliability ', function() {
it('should map each subtrack to correct project type ', function() {
var pt1 = ['DESIGN', 'DEVELOPMENT', 'TESTING_COMPETITION'];
var pt2 = [
'SPECIFICATION',
'ARCHITECTURE',
'COMPONENT_PRODUCTION',
'BUG_HUNT', 'DEPLOYMENT',
'SECURITY', 'PROCESS',
'TEST_SUITES',
'ASSEMBLY_COMPETITION',
'LEGACY',
'UI_PROTOTYPE_COMPETITION',
'CONCEPTUALIZATION',
'RIA_BUILD_COMPETITION',
'RIA_COMPONENT_COMPETITION',
'TEST_SCENARIOS',
'SPEC_REVIEW',
'COPILOT_POSTING',
'CONTENT_CREATION',
'REPORTING',
'MARATHON_MATCH',
'FIRST_2_FINISH',
'CODE'
];
var pt3 = [
'BANNERS_OR_ICONS',
'WEB_DESIGN',
'WIREFRAMES',
'LOGO_DESIGN',
'PRINT_OR_PRESENTATION',
'DESIGN_FIRST_2_FINISH',
'WIDGET_OR_MOBILE_SCREEN_DESIGN',
'FRONT_END_FLASH',
'APPLICATION_FRONT_END_DESIGN',
'STUDIO_OTHER',
'IDEA_GENERATION'];
var pt4 = ['GENERIC_SCORECARDS'];
pt1.forEach(function(subTrack) {
expect(UserStatsService.mapReliability(subTrack)).to.equal(1);
});
pt2.forEach(function(subTrack) {
expect(UserStatsService.mapReliability(subTrack)).to.equal(2);
});
pt3.forEach(function(subTrack) {
expect(UserStatsService.mapReliability(subTrack)).to.equal(3);
});
pt4.forEach(function(subTrack) {
expect(UserStatsService.mapReliability(subTrack)).to.equal(4);
});
// for any other subtrack it should return 2
expect(UserStatsService.mapReliability('unkown')).to.equal(2);

});
});

});