Skip to content

Commit 53271dc

Browse files
committed
Fix for white screen when searching on self-service tab
https://topcoder.atlassian.net/browse/PROD-4222
1 parent 53858c3 commit 53271dc

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

src/actions/challenges.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import { removeChallengeFromPhaseProduct, saveChallengeAsPhaseProduct } from '..
6262
* @param {number} page
6363
* @param {string} projectId
6464
* @param {string} status
65+
* @param {boolean} dashboard is in dashboard or not
6566
* @param {string} filterChallengeName
6667
* @param {bool} selfService
6768
* @param {string} userHandle this will be null for admin user(we will return all datas for admin user)
@@ -77,6 +78,7 @@ export function loadChallengesByPage (
7778
page,
7879
projectId,
7980
status,
81+
dashboard,
8082
filterChallengeName = null,
8183
selfService = false,
8284
userHandle = null,
@@ -156,16 +158,21 @@ export function loadChallengesByPage (
156158
filters['memberId'] = userId
157159
}
158160

159-
if (status === 'all') {
160-
delete filters['status']
161-
} else if (!_.isEmpty(status)) {
162-
filters['status'] = status === '' ? undefined : _.startCase(status.toLowerCase())
163-
} else if (!(_.isInteger(projectId) && projectId > 0)) {
161+
if (status !== 'all') {
162+
filters['status'] = !status ? undefined : _.startCase(status.toLowerCase())
163+
}
164+
165+
if (!dashboard && !filters['status'] && !(_.isInteger(projectId) && projectId > 0)) {
164166
filters['status'] = 'Active'
165167
}
166168
if (selfService) {
167169
filters.selfService = true
168-
if (userHandle && filters.status.toUpperCase() !== CHALLENGE_STATUS.DRAFT && filters.status.toUpperCase() !== CHALLENGE_STATUS.NEW) {
170+
const filtersStatus = filters.status ? filters.status.toUpperCase() : filters.status
171+
if (
172+
userHandle &&
173+
filtersStatus !== CHALLENGE_STATUS.DRAFT &&
174+
filtersStatus !== CHALLENGE_STATUS.NEW
175+
) {
169176
filters.selfServiceCopilot = userHandle
170177
}
171178
}

src/components/ChallengesComponent/ChallengeList/index.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require('bootstrap/scss/bootstrap.scss')
3131
const defaultSearchParam = {
3232
searchText: '',
3333
challengeProjectOption: null,
34-
challengeStatus: '',
34+
challengeStatus: 'all',
3535
challengeType: null,
3636
sortBy: 'startDate',
3737
sortOrder: 'desc',
@@ -112,7 +112,8 @@ class ChallengeList extends Component {
112112
loadChallengesByPage(
113113
1,
114114
projectId,
115-
!projectStatus ? 'all' : projectStatus,
115+
projectStatus,
116+
dashboard,
116117
searchText,
117118
selfService,
118119
this.getHandle(),
@@ -150,6 +151,7 @@ class ChallengeList extends Component {
150151
pageNumber,
151152
projectId,
152153
status,
154+
dashboard,
153155
searchText,
154156
selfService,
155157
this.getHandle(),
@@ -188,6 +190,7 @@ class ChallengeList extends Component {
188190
1,
189191
projectId,
190192
status,
193+
dashboard,
191194
searchText,
192195
selfService,
193196
this.getHandle(),
@@ -211,12 +214,14 @@ class ChallengeList extends Component {
211214
loadChallengesByPage,
212215
activeProjectId,
213216
status,
214-
selfService
217+
selfService,
218+
dashboard
215219
} = this.props
216220
loadChallengesByPage(
217221
page,
218222
activeProjectId,
219223
status,
224+
dashboard,
220225
searchText,
221226
selfService,
222227
this.getHandle(),
@@ -301,6 +306,7 @@ class ChallengeList extends Component {
301306
page,
302307
projectId,
303308
status,
309+
dashboard,
304310
searchText,
305311
selfService,
306312
this.getHandle(),
@@ -346,15 +352,16 @@ class ChallengeList extends Component {
346352
loadChallengesByPage(
347353
1,
348354
projectId,
349-
'all',
350-
'',
355+
defaultSearchParam.challengeStatus,
356+
dashboard,
357+
defaultSearchParam.searchText,
351358
selfService,
352359
this.getHandle(),
353360
this.getLoginUserId(),
354-
null,
355-
{},
356-
null,
357-
null,
361+
defaultSearchParam.challengeType,
362+
defaultSearchParam.challengeDate,
363+
defaultSearchParam.sortBy,
364+
defaultSearchParam.sortOrder,
358365
PAGE_SIZE
359366
)
360367
}

src/containers/Challenges/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class Challenges extends Component {
8181
this.props.loadChallengesByPage(
8282
1,
8383
projectId ? parseInt(projectId) : -1,
84-
dashboard ? 'all' : '',
84+
'all',
85+
dashboard,
8586
'',
8687
selfService,
8788
isAdmin ? null : this.props.auth.user.handle,

0 commit comments

Comments
 (0)