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

Commit 579937f

Browse files
committed
Fix submitted by shubhendus for skill picker challenge
1 parent 2545972 commit 579937f

File tree

3 files changed

+6585
-2288
lines changed

3 files changed

+6585
-2288
lines changed

app/skill-picker/skill-picker.controller.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import _ from 'lodash'
2727
vm.communities = {}
2828
vm.isPageDirty = isPageDirty
2929
vm.isTracksDirty = isTracksDirty
30+
vm.isCommunitySelected = isCommunitySelected
3031
///////
3132
activate()
3233

@@ -51,6 +52,13 @@ import _ from 'lodash'
5152
function isTracksDirty() {
5253
return vm.tracks.DESIGN || vm.tracks.DEVELOP || vm.tracks.DATA_SCIENCE
5354
}
55+
/**
56+
* Verfies if the communities section state has been modified by the user in any way.
57+
*/
58+
function isCommunitySelected() {
59+
var community = _.find(vm.communities, {status: true, display: true})
60+
return !!community
61+
}
5462

5563
/**
5664
* Verfies if the communities section state has been modified by the user in any way.
@@ -64,6 +72,13 @@ import _ from 'lodash'
6472
* Initializes the communities to show in the communities section.
6573
*/
6674
function initCommunities() {
75+
vm.communities['ibm_cognitive'] = {
76+
displayName: 'Cognitive',
77+
programId: vm.IBM_COGNITIVE_PROGRAM_ID,
78+
status: true,
79+
dirty: true,
80+
display: true
81+
}
6782
vm.communities['ios'] = {
6883
displayName: 'iOS',
6984
programId: vm.IOS_PROGRAM_ID,
@@ -78,13 +93,6 @@ import _ from 'lodash'
7893
dirty: false,
7994
display: true
8095
}
81-
vm.communities['ibm_cognitive'] = {
82-
displayName: 'Cognitive',
83-
programId: vm.IBM_COGNITIVE_PROGRAM_ID,
84-
status: true,
85-
dirty: true,
86-
display: true
87-
}
8896
_addWatchToCommunity(vm.communities['ios'])
8997
_addWatchToCommunity(vm.communities['predix'])
9098
_addWatchToCommunity(vm.communities['ibm_cognitive'])
@@ -125,8 +133,7 @@ import _ from 'lodash'
125133
if (community) {
126134
// set display false to avoid showing already enabled/registered program
127135
// we expect display property to be modified after first load of the page
128-
community.display = false
129-
community.status = true
136+
// community.status = true
130137
if (community.unregister){
131138
community.unregister()
132139
_addWatchToCommunity(community)

app/skill-picker/skill-picker.jade

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@
7474
type="button",
7575
tc-busy-button, tc-busy-when="vm.saving",
7676
ng-click="vm.submitSkills()",
77-
ng-disabled="vm.disableDoneButton || !vm.isTracksDirty()") Done
77+
ng-disabled="vm.disableDoneButton || !vm.isCommunitySelected()") Done

0 commit comments

Comments
 (0)