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

Commit 29b3c66

Browse files
author
vikasrohit
committed
Merge pull request #643 from appirio-tech/feature/SUP-2899
Feature/sup 2899
2 parents 99bfdb0 + 7e2d51a commit 29b3c66

File tree

4 files changed

+103
-3
lines changed

4 files changed

+103
-3
lines changed

app/index.jade

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ html
156156
script(src='../bower_components/react/react.js')
157157
script(src='../bower_components/react/react-dom.js')
158158
script(src='../bower_components/classnames/index.js')
159+
script(src='../bower_components/classnames/bind.js')
160+
script(src='../bower_components/classnames/dedupe.js')
159161
script(src='../bower_components/react-input-autosize/dist/react-input-autosize.min.js')
160162
script(src='../bower_components/react-select/dist/react-select.min.js')
161163
script(src='../bower_components/ngReact/ngReact.js')

app/profile/subtrack/subtrack.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
var reliability = vm.subTrackStats.filter(function(stat) { return stat.label === 'reliability'; });
7979
if (reliability.length > 0) {
8080
reliability = reliability[0];
81-
reliability.link = 'http://community.' + vm.domain + '/tc?module=ReliabilityDetail&pt=2&cr=' + profileVm.profile.userId;
81+
reliability.link = 'http://community.' + vm.domain + '/tc?module=ReliabilityDetail&pt=' + UserStatsService.mapReliability(vm.subTrack) + '&cr=' + profileVm.profile.userId;
8282
}
8383
var mustHaveMetrics = ["rank", "rating", "reliability"];
8484
// check if rating, rank & reliability are all set

app/services/userStats.service.js

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
processStats: processStats,
1717
compileSubtracks: compileSubtracks,
1818
filterStats: filterStats,
19-
processStatRank: processStatRank
19+
processStatRank: processStatRank,
20+
mapReliability: mapReliability
2021
};
2122

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

163-
164+
function mapReliability(subTrack) {
165+
var reliabilityMapping = {
166+
'DESIGN': 1,
167+
'DEVELOPMENT': 1,
168+
'TESTING_COMPETITION': 1,
169+
'SPECIFICATION': 2,
170+
'ARCHITECTURE': 2,
171+
'COMPONENT_PRODUCTION': 2,
172+
'BUG_HUNT': 2,
173+
'DEPLOYMENT': 2,
174+
'SECURITY': 2,
175+
'PROCESS': 2,
176+
'TEST_SUITES': 2,
177+
'ASSEMBLY_COMPETITION': 2,
178+
'LEGACY': 2,
179+
'BANNERS_OR_ICONS': 3,
180+
'WEB_DESIGN': 3,
181+
'WIREFRAMES': 3,
182+
'UI_PROTOTYPE_COMPETITION': 2,
183+
'LOGO_DESIGN': 3,
184+
'PRINT_OR_PRESENTATION': 3,
185+
'CONCEPTUALIZATION': 2,
186+
'RIA_BUILD_COMPETITION': 2,
187+
'RIA_COMPONENT_COMPETITION': 2,
188+
'TEST_SCENARIOS': 2,
189+
'SPEC_REVIEW': 2,
190+
'GENERIC_SCORECARDS': 4,
191+
'COPILOT_POSTING': 2,
192+
'CONTENT_CREATION': 2,
193+
'WIDGET_OR_MOBILE_SCREEN_DESIGN': 3,
194+
'FRONT_END_FLASH': 3,
195+
'APPLICATION_FRONT_END_DESIGN': 3,
196+
'STUDIO_OTHER': 3,
197+
'IDEA_GENERATION': 3,
198+
'REPORTING': 2,
199+
'MARATHON_MATCH': 2,
200+
'FIRST_2_FINISH': 2,
201+
'CODE': 2,
202+
'DESIGN_FIRST_2_FINISH': 3
203+
};
204+
205+
return reliabilityMapping[subTrack] || 2;
206+
}
164207
}
165208

166209
})();

app/services/userStats.service.spec.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,5 +382,60 @@ describe('User Stats Service', function() {
382382
});
383383
});
384384

385+
describe('mapReliability ', function() {
386+
it('should map each subtrack to correct project type ', function() {
387+
var pt1 = ['DESIGN', 'DEVELOPMENT', 'TESTING_COMPETITION'];
388+
var pt2 = [
389+
'SPECIFICATION',
390+
'ARCHITECTURE',
391+
'COMPONENT_PRODUCTION',
392+
'BUG_HUNT', 'DEPLOYMENT',
393+
'SECURITY', 'PROCESS',
394+
'TEST_SUITES',
395+
'ASSEMBLY_COMPETITION',
396+
'LEGACY',
397+
'UI_PROTOTYPE_COMPETITION',
398+
'CONCEPTUALIZATION',
399+
'RIA_BUILD_COMPETITION',
400+
'RIA_COMPONENT_COMPETITION',
401+
'TEST_SCENARIOS',
402+
'SPEC_REVIEW',
403+
'COPILOT_POSTING',
404+
'CONTENT_CREATION',
405+
'REPORTING',
406+
'MARATHON_MATCH',
407+
'FIRST_2_FINISH',
408+
'CODE'
409+
];
410+
var pt3 = [
411+
'BANNERS_OR_ICONS',
412+
'WEB_DESIGN',
413+
'WIREFRAMES',
414+
'LOGO_DESIGN',
415+
'PRINT_OR_PRESENTATION',
416+
'DESIGN_FIRST_2_FINISH',
417+
'WIDGET_OR_MOBILE_SCREEN_DESIGN',
418+
'FRONT_END_FLASH',
419+
'APPLICATION_FRONT_END_DESIGN',
420+
'STUDIO_OTHER',
421+
'IDEA_GENERATION'];
422+
var pt4 = ['GENERIC_SCORECARDS'];
423+
pt1.forEach(function(subTrack) {
424+
expect(UserStatsService.mapReliability(subTrack)).to.equal(1);
425+
});
426+
pt2.forEach(function(subTrack) {
427+
expect(UserStatsService.mapReliability(subTrack)).to.equal(2);
428+
});
429+
pt3.forEach(function(subTrack) {
430+
expect(UserStatsService.mapReliability(subTrack)).to.equal(3);
431+
});
432+
pt4.forEach(function(subTrack) {
433+
expect(UserStatsService.mapReliability(subTrack)).to.equal(4);
434+
});
435+
// for any other subtrack it should return 2
436+
expect(UserStatsService.mapReliability('unkown')).to.equal(2);
437+
438+
});
439+
});
385440

386441
});

0 commit comments

Comments
 (0)