Skip to content

Commit ec4094c

Browse files
authored
Merge pull request #4872 from topcoder-platform/gig-work-fix
Gig work fix
2 parents 376aa82 + 1cce4d4 commit ec4094c

File tree

29 files changed

+121
-114
lines changed

29 files changed

+121
-114
lines changed

.circleci/config.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,21 @@ workflows:
230230
filters:
231231
branches:
232232
only:
233-
- feature-contentful
233+
- develop
234234
# This is alternate dev env for parallel testing
235235
- "build-test":
236236
context : org-global
237237
filters:
238238
branches:
239239
only:
240240
- feature-contentful
241-
- hot-fix
242241
# This is alternate dev env for parallel testing
243242
- "build-qa":
244243
context : org-global
245244
filters:
246245
branches:
247246
only:
248-
- hot-fix
247+
- community-app-tests-poc
249248
# This is beta env for production soft releases
250249
- "build-prod-beta":
251250
context : org-global
@@ -259,7 +258,6 @@ workflows:
259258
filters:
260259
branches:
261260
only:
262-
- feature-contentful
263261
- develop
264262
# Production builds are exectuted
265263
# when PR is merged to the master

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ ARG TC_M2M_AUTH0_PROXY_SERVER_URL
6464
ARG TC_M2M_AUTH0_URL
6565
ARG AUTH_SECRET
6666

67+
ARG COMMUNITY_APP_URL
68+
6769
################################################################################
6870
# Setting of environment variables in the Docker image.
6971

@@ -117,6 +119,7 @@ ENV CONTENTFUL_EDU_SPACE_ID=$CONTENTFUL_EDU_SPACE_ID
117119
ENV CONTENTFUL_EDU_CDN_API_KEY=$CONTENTFUL_EDU_CDN_API_KEY
118120
ENV CONTENTFUL_EDU_PREVIEW_API_KEY=$CONTENTFUL_EDU_PREVIEW_API_KEY
119121
ENV RECRUITCRM_API_KEY=$RECRUITCRM_API_KEY
122+
ENV COMMUNITY_APP_URL=$COMMUNITY_APP_URL
120123

121124
################################################################################
122125
# Testing and build of the application inside the container.

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ docker build -t $TAG \
4343
--build-arg CONTENTFUL_COMCAST_SPACE_ID=$CONTENTFUL_COMCAST_SPACE_ID \
4444
--build-arg CONTENTFUL_COMCAST_CDN_API_KEY=$CONTENTFUL_COMCAST_CDN_API_KEY \
4545
--build-arg CONTENTFUL_COMCAST_PREVIEW_API_KEY=$CONTENTFUL_COMCAST_PREVIEW_API_KEY \
46-
--build-arg RECRUITCRM_API_KEY=$RECRUITCRM_API_KEY .
46+
--build-arg RECRUITCRM_API_KEY=$RECRUITCRM_API_KEY \
47+
--build-arg COMMUNITY_APP_URL=$COMMUNITY_APP_URL .
4748

4849
# Copies "node_modules" from the created image, if necessary for caching.
4950
docker create --name app $TAG

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
138138
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
139139
"tc-ui": "^1.0.12",
140-
"topcoder-react-lib": "1.0.0",
140+
"topcoder-react-lib": "1.0.3",
141141
"topcoder-react-ui-kit": "2.0.0",
142142
"topcoder-react-utils": "0.7.8",
143143
"turndown": "^4.0.2",

src/assets/images/gig-blob.svg

Lines changed: 23 additions & 0 deletions
Loading

src/assets/images/img-gig-work.png

254 KB
Loading

src/server/tc-communities/tco19/metadata.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"challengeFilter": {
3-
"groupIds": ["20000078"],
4-
"or": [{
5-
"tags": ["TCO", "TCO19"]
6-
}]
3+
"events": ["tco19"]
74
},
85
"communityId": "tco19",
96
"communityName": "TCO19",

src/server/tc-communities/tco20/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"challengeFilter": {
3-
"tags": ["TCO", "TCO20"]
3+
"events": ["tco20"]
44
},
55
"communityId": "tco20",
66
"communityName": "TCO20",

src/server/tc-communities/tco21/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"challengeFilter": {
3-
"tags": ["TCO", "TCO21"]
3+
"events": ["tco21"]
44
},
55
"communityId": "tco21",
66
"communityName": "TCO21",

src/shared/actions/challenge-listing/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function getUserChallengesInit(uuid) {
339339
function getUserChallengesDone(userId, tokenV3) {
340340
const service = getService(tokenV3);
341341

342-
return service.getUserResources(userId)
342+
return service.getUserResources(userId, 1, 10000)
343343
.then(item => item)
344344
.catch((error) => {
345345
fireErrorMessage('Error Getting User Challenges', error.content || error);

src/shared/actions/tc-communities/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getListInit(uuid) {
3838
* @return {Promise}
3939
*/
4040
function getListDone(uuid, auth) {
41-
const groups = _.get(auth, 'profile.groups', []).map(g => g.oldId);
41+
const groups = _.get(auth, 'profile.groups', []).map(g => g.id);
4242
return getCommunitiesService(auth.tokenV3)
4343
.getList(groups).then(list => ({ list, uuid }));
4444
}

src/shared/components/Contentful/Modal/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { errors } from 'topcoder-react-lib';
1414
import { themr } from 'react-css-super-themr';
1515
import classnames from 'classnames';
1616

17+
import defaultModalTheme from 'components/Leaderboard/ChallengeHistoryModal/styles.scss';
1718
import defaultStyle from './style.scss';
1819

1920
const { fireErrorMessage } = errors;
@@ -102,7 +103,10 @@ class ContentfulModal extends React.Component {
102103
className: classnames(theme.modalTrigger, child.props.className),
103104
}))}
104105
{isOpen && (
105-
<Modal onCancel={this.onCloseModal}>
106+
<Modal
107+
onCancel={this.onCloseModal}
108+
theme={defaultModalTheme}
109+
>
106110
<div
107111
className={theme.dismissButton}
108112
onClick={this.onCloseModal}

src/shared/components/GUIKit/JobListCard/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
}
5050

5151
&:first-child {
52-
width: 200px;
52+
width: 250px;
5353
}
5454

5555
&:nth-child(2) {

src/shared/components/Gigs/GigDetails.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export default function GigDetails(props) {
137137
</li>
138138
<li>
139139
<img src={iconLabel2} alt="label 2" />
140-
<div><strong>Subscribe to our <a target="_blank" rel="noreferrer" href="https://www.topcoder.com/community/taas">Gig notifications email.</a>.</strong> We’ll send you a weekly update on gigs available so you don’t miss a beat.</div>
140+
<div><strong>Subscribe to our <a target="_blank" rel="noreferrer" href="https://www.topcoder.com/community/taas">Gig notifications email</a>.</strong> We’ll send you a weekly update on gigs available so you don’t miss a beat.</div>
141141
</li>
142142
<li>
143143
<img src={iconLabel3} alt="label 3" />

src/shared/components/Gigs/style.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142

143143
img {
144144
margin-right: 16px;
145+
min-width: 40px;
145146
}
146147

147148
&:last-child {
@@ -163,6 +164,7 @@
163164
font-weight: 600;
164165
font-family: Barlow, sans-serif;
165166
margin-top: 20px;
167+
line-height: 20px;
166168
}
167169
}
168170

@@ -189,6 +191,7 @@
189191
.skills {
190192
display: flex;
191193
align-items: center;
194+
line-height: 21px;
192195
/* stylelint-disable */
193196
img {
194197
margin-right: 8px;

src/shared/components/ReviewOpportunityDetailsPage/ChallengeSpecTab/index.jsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ const ChallengeSpecTab = ({ challenge }) => (
2929
</article>
3030
)
3131
}
32-
{
33-
challenge.finalSubmissionGuidelines
34-
&& (
35-
<article>
36-
<h2 styleName="h2">
37-
Final Submission Guidelines
38-
</h2>
39-
<div
40-
/* eslint-disable react/no-danger */
41-
dangerouslySetInnerHTML={{
42-
__html: challenge.finalSubmissionGuidelines,
43-
}}
44-
/* eslint-enable react/no-danger */
45-
styleName="rawHtml"
46-
/>
47-
</article>
48-
)
49-
}
5032
</div>
5133
);
5234

src/shared/components/challenge-detail/Header/DeadlinesPanel/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import moment from 'moment-timezone';
66
import PT from 'prop-types';
77
import React from 'react';
88

9+
import { phaseEndDate, phaseStartDate } from 'utils/challenge-listing/helper';
910
import Card from './Card';
1011
import './style.scss';
1112

1213
export default function DeadlinesPanel({ deadlines }) {
1314
/* Calculates challenge start time. */
1415
let start = deadlines[0] || {};
15-
start = start.actualStartDate || start.scheduledStartDate;
16-
const started = moment(start).isBefore(moment());
16+
start = phaseStartDate(start);
17+
const started = moment(start).isBefore();
1718

1819
return (
1920
<div styleName="panel" tabIndex="0" role="tabpanel">
@@ -29,7 +30,7 @@ export default function DeadlinesPanel({ deadlines }) {
2930
{ deadlines.map((d, index) => (
3031
<Card
3132
key={d.name}
32-
time={d.scheduledEndDate || d.actualEndDate}
33+
time={phaseEndDate(d)}
3334
title={index === deadlines.length - 1 ? 'Winners' : d.name}
3435
/>
3536
))}

src/shared/components/challenge-detail/Header/index.jsx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import React from 'react';
1515
import { DangerButton, PrimaryButton } from 'topcoder-react-ui-kit';
1616
import { Link } from 'topcoder-react-utils';
1717
import { COMPETITION_TRACKS } from 'utils/tc';
18+
import { phaseEndDate } from 'utils/challenge-listing/helper';
1819

1920
import LeftArrow from 'assets/images/arrow-prev.svg';
2021

@@ -69,16 +70,17 @@ export default function ChallengeHeader(props) {
6970
numOfRegistrants,
7071
numOfCheckpointSubmissions,
7172
numOfSubmissions,
72-
endDate,
7373
status,
7474
type,
7575
track,
7676
} = challenge;
7777

7878
const tags = challenge.tags || [];
79-
const appealsEndDate = endDate;
8079

8180
const allPhases = challenge.phases || [];
81+
const sortedAllPhases = _.cloneDeep(allPhases)
82+
.sort((a, b) => moment(phaseEndDate(a)).diff(phaseEndDate(b)));
83+
8284
const { prizes } = prizeSets && prizeSets.length ? prizeSets[0] : [];
8385

8486
const checkpointPrizes = _.find(prizeSets, { type: 'checkpoint' });
@@ -122,14 +124,14 @@ export default function ChallengeHeader(props) {
122124
*/
123125
const hasSubmissions = !_.isEmpty(mySubmissions);
124126

125-
let nextPhase = allPhases.filter(p => p.isOpen)
126-
.sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
127-
if (hasRegistered && allPhases[0] && allPhases[0].name === 'Registration') {
128-
nextPhase = allPhases[1] || {};
127+
const openPhases = sortedAllPhases.filter(p => p.isOpen);
128+
let nextPhase = openPhases[0];
129+
if (hasRegistered && openPhases[0] && openPhases[0].name === 'Registration') {
130+
nextPhase = openPhases[1] || {};
129131
}
130132
const nextDeadline = nextPhase && nextPhase.name;
131133

132-
const deadlineEnd = moment(nextPhase && nextPhase.scheduledEndDate);
134+
const deadlineEnd = moment(nextPhase && phaseEndDate(nextPhase));
133135
const currentTime = moment();
134136

135137
let timeLeft = deadlineEnd.isAfter(currentTime)
@@ -147,8 +149,8 @@ export default function ChallengeHeader(props) {
147149
if (showDeadlineDetail) {
148150
relevantPhases = (allPhases || []).filter((phase) => {
149151
if (phase.name === 'Iterative Review') {
150-
const end = phase.actualEndDate || phase.scheduledEndDate;
151-
return moment(end).isAfter(moment());
152+
const end = phaseEndDate(phase);
153+
return moment(end).isAfter();
152154
}
153155
const phaseLowerCase = phase.name.toLowerCase();
154156
if (phaseLowerCase.includes('screening') || phaseLowerCase.includes('specification')) {
@@ -168,30 +170,34 @@ export default function ChallengeHeader(props) {
168170
if (b.name.toLowerCase().includes('registration')) {
169171
return 1;
170172
}
171-
return (new Date(a.scheduledEndDate || a.actualEndDate)).getTime()
172-
- (new Date(b.scheduledEndDate || b.actualEndDate)).getTime();
173+
const aEndDate = phaseEndDate(a);
174+
const bEndDate = phaseEndDate(b);
175+
return moment(aEndDate).diff(bEndDate);
173176
});
174177
if (type === 'First2Finish' && status === 'Completed') {
175178
const phases2 = allPhases.filter(p => p.name === 'Iterative Review' && !p.isOpen);
176-
const endPhaseDate = Math.max(...phases2.map(d => new Date(d.scheduledEndDate)));
179+
const endPhaseDate = Math.max(...phases2.map(d => phaseEndDate(d)));
177180
relevantPhases = _.filter(relevantPhases, p => (p.name.toLowerCase().includes('registration')
178-
|| new Date(p.scheduledEndDate).getTime() < endPhaseDate));
181+
|| phaseEndDate(p).getTime() < endPhaseDate));
179182
relevantPhases.push({
180183
id: -1,
181184
name: 'Winners',
185+
isOpen: false,
186+
actualEndDate: endPhaseDate,
182187
scheduledEndDate: endPhaseDate,
183188
});
184189
} else if (relevantPhases.length > 1) {
185190
const lastPhase = relevantPhases[relevantPhases.length - 1];
186-
const lastPhaseTime = (
187-
new Date(lastPhase.actualEndDate || lastPhase.scheduledEndDate)
188-
).getTime();
191+
const lastPhaseTime = phaseEndDate(lastPhase).getTime();
189192

190-
const appealsEnd = (new Date(appealsEndDate).getTime());
191-
if (lastPhaseTime < appealsEnd && lastPhase.name !== 'Review') {
193+
const appealsEndDate = phaseEndDate(sortedAllPhases[sortedAllPhases.length - 1]);
194+
const appealsEnd = appealsEndDate.getTime();
195+
if (lastPhaseTime < appealsEnd) {
192196
relevantPhases.push({
193197
id: -1,
194198
name: 'Winners',
199+
isOpen: false,
200+
actualEndDate: appealsEndDate,
195201
scheduledEndDate: appealsEndDate,
196202
});
197203
}
@@ -495,7 +501,6 @@ ChallengeHeader.propTypes = {
495501
numOfCheckpointSubmissions: PT.any,
496502
numOfSubmissions: PT.any,
497503
status: PT.any,
498-
endDate: PT.any,
499504
phases: PT.any,
500505
roundId: PT.any,
501506
prizeSets: PT.any,

src/shared/components/challenge-detail/MySubmissions/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MySubmissionsView extends React.Component {
4141
}
4242

4343
if (isMM) {
44-
loadMMSubmissions(challenge.id, challenge.registrants, auth.tokenV3);
44+
loadMMSubmissions(challenge.id, auth.tokenV3);
4545
}
4646
}
4747

0 commit comments

Comments
 (0)