Skip to content

hot-fix branches merge into master #3611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a31ff62
No loading active challenges when pulling up past challenges to incre…
gets0ul Jan 21, 2020
20232b0
Merge pull request #3587 from gets0ul/issue_3548
LieutenantRoger Jan 22, 2020
e552f01
deploying on dev env
sushilshinde Jan 22, 2020
f5be3e9
merge with develop
LieutenantRoger Jan 22, 2020
a3063a5
issue 3582 fix
PrakashDurlabhji Jan 22, 2020
2f79fbf
lint fix
PrakashDurlabhji Jan 22, 2020
2640204
Update index.jsx
rashmi73 Jan 22, 2020
ede49ca
Merge pull request #3599 from PrakashDurlabhji/issue_3582_2
LieutenantRoger Jan 23, 2020
d911b20
Merge pull request #3601 from rashmi73/issue_3536
LieutenantRoger Jan 23, 2020
3bb0478
Merge pull request #3594 from topcoder-platform/hot-fix-performance
sushilshinde Jan 23, 2020
dde3830
deploying on dev
sushilshinde Jan 23, 2020
9384840
deploying on dev
sushilshinde Jan 24, 2020
823157b
merge with develop
LieutenantRoger Jan 24, 2020
a1c2683
Merge pull request #3612 from topcoder-platform/hot-fix-challenge-det…
sushilshinde Jan 24, 2020
76d99d9
Merge pull request #18 from topcoder-platform/hot-fix-no-result
PrakashDurlabhji Jan 25, 2020
8cfedbd
issue 3582 style fix
PrakashDurlabhji Jan 25, 2020
1fcbdbb
Update index.jsx
PrakashDurlabhji Jan 25, 2020
453f254
Update style.scss
PrakashDurlabhji Jan 25, 2020
16f7e59
issue 3582 style fix
PrakashDurlabhji Jan 26, 2020
6749798
issue 3582 fix
PrakashDurlabhji Jan 26, 2020
3cf1cd0
Update buckets.js
PrakashDurlabhji Jan 26, 2020
450f316
Update buckets.js
PrakashDurlabhji Jan 27, 2020
41e27c9
issue 3582 my bucket issue fix
PrakashDurlabhji Jan 27, 2020
d2944c1
test fix
PrakashDurlabhji Jan 27, 2020
8a8a92e
Merge pull request #3615 from PrakashDurlabhji/issue_3582_2
LieutenantRoger Jan 28, 2020
2376e34
merge develop into hot-fix-no-result
LieutenantRoger Jan 29, 2020
a18b377
Merge pull request #3617 from topcoder-platform/hot-fix-no-result
sushilshinde Jan 29, 2020
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: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ workflows:
branches:
only:
- develop
- feature-member-profiles
- hot-fix-no-result
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Matches shallow shapshot 1`] = `
location="/"
>
<Bucket
activeBucket=""
bucket={
Object {
"filter": Object {
Expand Down Expand Up @@ -91,6 +92,7 @@ exports[`Matches shallow shapshot 2`] = `
location="/"
>
<Bucket
activeBucket=""
bucket={
Object {
"filter": Object {
Expand Down Expand Up @@ -239,6 +241,7 @@ exports[`Matches shallow shapshot 3`] = `
location="/"
>
<Bucket
activeBucket=""
bucket={
Object {
"filter": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class SubmissionsComponent extends React.Component {
}
case 'Time':
case 'Submission Date': {
valueA = new Date(a.submissions[0].submissionTime);
valueB = new Date(b.submissions[0].submissionTime);
valueA = new Date(a.submissions && a.submissions[0].submissionTime);
valueB = new Date(b.submissions && b.submissions[0].submissionTime);
break;
}
case 'Initial / Final Score': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PT from 'prop-types';
import qs from 'qs';
import React from 'react';
import Sort from 'utils/challenge-listing/sort';
import { NO_LIVE_CHALLENGES_CONFIG, BUCKETS } from 'utils/challenge-listing/buckets';
import SortingSelectBar from 'components/SortingSelectBar';
import Waypoint from 'react-waypoint';
import { challenge as challengeUtils } from 'topcoder-react-lib';
Expand Down Expand Up @@ -42,6 +43,7 @@ export default function Bucket({
userHandle,
expandedTags,
expandTag,
activeBucket,
}) {
const filter = Filter.getFilterFunction(bucket.filter);
const activeSort = sort || bucket.sorts[0];
Expand All @@ -67,7 +69,16 @@ export default function Bucket({
}
}

if (!filteredChallenges.length && !loadMore) return null;
if (!filteredChallenges.length && !loadMore) {
if (activeBucket === BUCKETS.ALL) {
return null;
}
return (
<div styleName="no-results">
{`${NO_LIVE_CHALLENGES_CONFIG[bucketId]}`}
</div>
);
}

const cards = filteredChallenges.map(item => (
<ChallengeCard
Expand Down Expand Up @@ -158,6 +169,7 @@ Bucket.defaultProps = {
userHandle: '',
expandedTags: [],
expandTag: null,
activeBucket: '',
};

Bucket.propTypes = {
Expand All @@ -182,4 +194,5 @@ Bucket.propTypes = {
userHandle: PT.string,
expandedTags: PT.arrayOf(PT.number),
expandTag: PT.func,
activeBucket: PT.string,
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@
border: 3px solid #79a3ef;
border-radius: 4px;
}

.no-results {
@include tc-label-lg;

display: flex;
align-items: center;
justify-content: center;
padding: $base-unit * 5;
}
33 changes: 32 additions & 1 deletion src/shared/components/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import _ from 'lodash';
import React from 'react';
import PT from 'prop-types';
import { connect } from 'react-redux';
import { BUCKETS, getBuckets, isReviewOpportunitiesBucket } from 'utils/challenge-listing/buckets';
import {
BUCKETS, getBuckets, isReviewOpportunitiesBucket, NO_LIVE_CHALLENGES_CONFIG,
} from 'utils/challenge-listing/buckets';
import { challenge as challengeUtils } from 'topcoder-react-lib';
import Bucket from './Bucket';
import ReviewOpportunityBucket from './ReviewOpportunityBucket';
import './style.scss';

const Filter = challengeUtils.filter;

function Listing({
activeBucket,
auth,
Expand Down Expand Up @@ -39,6 +44,17 @@ function Listing({
expandTag,
}) {
const buckets = getBuckets(_.get(auth.user, 'handle'));
const isChallengesAvailable = (bucket) => {
const filter = Filter.getFilterFunction(buckets[bucket].filter);
const clonedChallenges = _.clone(challenges);
const filteredChallenges = [];
for (let i = 0; i < clonedChallenges.length; i += 1) {
if (filter(clonedChallenges[i])) {
filteredChallenges.push(clonedChallenges[i]);
}
}
return filteredChallenges.length > 0;
};
const getBucket = (bucket, expanded = false) => {
let keepPlaceholders = false;
let loading;
Expand Down Expand Up @@ -96,6 +112,7 @@ function Listing({
setSort={sort => setSort(bucket, sort)}
sort={sorts[bucket]}
userHandle={_.get(auth, 'user.handle')}
activeBucket={activeBucket}
/>
)
);
Expand All @@ -110,6 +127,20 @@ function Listing({
);
}

let isFilled = isChallengesAvailable(BUCKETS.OPEN_FOR_REGISTRATION)
|| isChallengesAvailable(BUCKETS.ONGOING);
if (auth.user) {
isFilled = isFilled || isChallengesAvailable(BUCKETS.MY);
}
if (!isFilled) {
return (
<div styleName="challengeCardContainer">
<div styleName="no-results">
{`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`}
</div>
</div>
);
}
return (
<div styleName="challengeCardContainer">
{preListingMsg}
Expand Down
10 changes: 10 additions & 0 deletions src/shared/components/challenge-listing/Listing/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,14 @@
padding-top: $base-unit;
margin: 0;
}

.no-results {
@include tc-label-lg;

display: flex;
align-items: center;
justify-content: center;
padding: $base-unit * 5;
border-radius: $corner-radius;
}
}
6 changes: 4 additions & 2 deletions src/shared/containers/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ export class ListingContainer extends React.Component {
logger.error('Attempt to mount multiple instances of ChallengeListingPageContainer at the same time!');
} else mounted = true;

this.loadChallenges();
if (BUCKETS.PAST !== activeBucket) this.loadChallenges();
}

componentDidUpdate(prevProps) {
const {
activeBucket,
auth,
dropChallenges,
getCommunitiesList,
Expand All @@ -98,7 +99,8 @@ export class ListingContainer extends React.Component {
});
}

if (!loadingActiveChallengesUUID && !_.isEmpty(meta) && !allActiveChallengesLoaded) {
if (!loadingActiveChallengesUUID && !_.isEmpty(meta) && !allActiveChallengesLoaded
&& BUCKETS.PAST !== activeBucket) {
getRestActiveChallenges(auth.tokenV3);
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/shared/utils/challenge-listing/buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ const BUCKET_DATA = {
},
};

export const NO_LIVE_CHALLENGES_CONFIG = {
[BUCKETS.ALL]: 'No Live Challenges found in All Challenges',
[BUCKETS.MY]: 'No challenges found in My Challenges',
[BUCKETS.OPEN_FOR_REGISTRATION]: 'No challenges found in Open for Registration',
[BUCKETS.ONGOING]: 'No challenges found in Ongoing Challenges',
[BUCKETS.PAST]: 'No challenges found in Past',
[BUCKETS.SAVED_FILTER]: 'No challenges found in Saved filter Challenges',
[BUCKETS.UPCOMING]: 'No challenges found in Upcoming Challenges',
};

/**
* Returns configuration of all possible challenge buckets.
* @param {String} userHandle Handle of the authenticated
Expand Down