Skip to content

Commit 07b1761

Browse files
committed
Fix: Challenge details page failed for tasks
Fixes #514
1 parent de2e50a commit 07b1761

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

.exchange-rates.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1506988800,"base":"USD","rates":{"AED":3.673097,"AFN":68.328,"ALL":114.02521,"AMD":478.609798,"ANG":1.787058,"AOA":165.9215,"ARS":17.3745,"AUD":1.277671,"AWG":1.792249,"AZN":1.7,"BAM":1.665744,"BBD":2,"BDT":82.067085,"BGN":1.666395,"BHD":0.377252,"BIF":1753.088054,"BMD":1,"BND":1.361446,"BOB":6.918079,"BRL":3.154388,"BSD":1,"BTC":0.000227333198,"BTN":65.368577,"BWP":10.371482,"BYN":1.964461,"BZD":2.018048,"CAD":1.251807,"CDF":1562.881563,"CHF":0.974754,"CLF":0.02371,"CLP":638.984158,"CNH":6.67337,"CNY":6.654408,"COP":2949.22,"CRC":571.811135,"CUC":1,"CUP":25.5,"CVE":93.7,"CZK":22.1091,"DJF":178.97,"DKK":6.344208,"DOP":47.526104,"DZD":113.267,"EGP":17.652,"ERN":15.33,"ETB":23.626656,"EUR":0.852373,"FJD":2.030098,"FKP":0.753381,"GBP":0.753381,"GEL":2.470879,"GGP":0.753381,"GHS":4.4084,"GIP":0.753381,"GMD":47.37,"GNF":8984.4,"GTQ":7.353937,"GYD":208.010254,"HKD":7.810385,"HNL":23.428833,"HRK":6.390162,"HTG":63.443476,"HUF":265.930333,"IDR":13525.286387,"ILS":3.53531,"IMP":0.753381,"INR":65.5817,"IQD":1169.200369,"IRR":33497,"ISK":106.51,"JEP":0.753381,"JMD":130.370525,"JOD":0.709001,"JPY":112.7749,"KES":103.205,"KGS":68.583252,"KHR":4067.291667,"KMF":417.331677,"KPW":900,"KRW":1143.36,"KWD":0.302072,"KYD":0.834309,"KZT":341.862659,"LAK":8312.1,"LBP":1505.737443,"LKR":153.318985,"LRD":117.662332,"LSL":13.625932,"LYD":1.368845,"MAD":9.4535,"MDL":17.568609,"MGA":3030,"MKD":52.47,"MMK":1368.08506,"MNT":2460.72,"MOP":8.054546,"MRO":365.417361,"MUR":33.9495,"MVR":15.409873,"MWK":726.944645,"MXN":18.243247,"MYR":4.2335,"MZN":61.25,"NAD":13.625932,"NGN":358.265905,"NIO":30.393169,"NOK":8.00655,"NPR":104.579331,"NZD":1.39055,"OMR":0.384992,"PAB":1,"PEN":3.270002,"PGK":3.195588,"PHP":51.09,"PKR":105.516068,"PLN":3.672952,"PYG":5691.052124,"QAR":3.6456,"RON":3.906707,"RSD":101.5425,"RUB":57.9136,"RWF":833.65244,"SAR":3.74995,"SBD":7.846981,"SCR":13.7675,"SDG":6.684495,"SEK":8.17039,"SGD":1.36197,"SHP":0.753381,"SLL":7603.75,"SOS":578.563398,"SRD":7.438,"SSP":127.202,"STD":20873.59961,"SVC":8.760118,"SYP":514.98999,"SZL":13.621477,"THB":33.43,"TJS":8.80521,"TMT":3.499986,"TND":2.487505,"TOP":2.224129,"TRY":3.568477,"TTD":6.77778,"TWD":30.455,"TZS":2245.4,"UAH":26.630064,"UGX":3620.858069,"USD":1,"UYU":29.145178,"UZS":8076.25,"VEF":10.192165,"VND":22768.566667,"VUV":104.823201,"WST":2.490089,"XAF":559.120181,"XAG":0.06026465,"XAU":0.00078665,"XCD":2.70255,"XDR":0.709577,"XOF":559.120181,"XPD":0.00109412,"XPF":101.715181,"XPT":0.0010941,"YER":250.306642,"ZAR":13.597829,"ZMW":9.716385,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1507035600,"base":"USD","rates":{"AED":3.673158,"AFN":68.2715,"ALL":113.98,"AMD":478.32,"ANG":1.784808,"AOA":165.9215,"ARS":17.3975,"AUD":1.281035,"AWG":1.792249,"AZN":1.7,"BAM":1.6645,"BBD":2,"BDT":81.963744,"BGN":1.664642,"BHD":0.377105,"BIF":1749.6,"BMD":1,"BND":1.362838,"BOB":6.909311,"BRL":3.159871,"BSD":1,"BTC":0.000233932679,"BTN":65.465469,"BWP":10.373854,"BYN":1.965345,"BZD":2.015491,"CAD":1.252134,"CDF":1562.881563,"CHF":0.974707,"CLF":0.02371,"CLP":637.515,"CNH":6.667158,"CNY":6.651,"COP":2949.1,"CRC":571.195,"CUC":1,"CUP":25.5,"CVE":93.7,"CZK":22.074355,"DJF":178.97,"DKK":6.334719,"DOP":47.438753,"DZD":113.260536,"EGP":17.6643,"ERN":15.335932,"ETB":23.507725,"EUR":0.851138,"FJD":2.030098,"FKP":0.755444,"GBP":0.755444,"GEL":2.472113,"GGP":0.755444,"GHS":4.410174,"GIP":0.755444,"GMD":47.33,"GNF":8940.2,"GTQ":7.350868,"GYD":206.152683,"HKD":7.81155,"HNL":23.403121,"HRK":6.3822,"HTG":63.419644,"HUF":265.7755,"IDR":13539.990958,"ILS":3.532402,"IMP":0.755444,"INR":65.5302,"IQD":1167.9,"IRR":33524.5,"ISK":105.992406,"JEP":0.755444,"JMD":129.049662,"JOD":0.709001,"JPY":113.06946,"KES":103.3325,"KGS":68.547054,"KHR":4054.65,"KMF":417.331677,"KPW":900,"KRW":1143.89,"KWD":0.302145,"KYD":0.833259,"KZT":342.991704,"LAK":8308.65,"LBP":1508.05,"LKR":153.200075,"LRD":117.662332,"LSL":13.670513,"LYD":1.369894,"MAD":9.4589,"MDL":17.577873,"MGA":3030.15,"MKD":52.415,"MMK":1362.35,"MNT":2458.410153,"MOP":8.044884,"MRO":364.700827,"MUR":33.905,"MVR":15.409873,"MWK":726.32,"MXN":18.29977,"MYR":4.23424,"MZN":61.275,"NAD":13.70255,"NGN":357.52,"NIO":30.312572,"NOK":7.99491,"NPR":104.740724,"NZD":1.395618,"OMR":0.385017,"PAB":1,"PEN":3.265227,"PGK":3.194222,"PHP":51.171,"PKR":105.380465,"PLN":3.669797,"PYG":5655.95,"QAR":3.6408,"RON":3.906927,"RSD":101.490982,"RUB":58.1247,"RWF":833.12,"SAR":3.750218,"SBD":7.846981,"SCR":13.768,"SDG":6.676902,"SEK":8.144897,"SGD":1.36335,"SHP":0.755444,"SLL":7603.75,"SOS":578.500064,"SRD":7.438,"SSP":127.4717,"STD":20836.499582,"SVC":8.749375,"SYP":514.99499,"SZL":13.674763,"THB":33.43,"TJS":8.800211,"TMT":3.499986,"TND":2.474956,"TOP":2.224854,"TRY":3.587729,"TTD":6.774279,"TWD":30.431,"TZS":2245.15,"UAH":26.711871,"UGX":3605.15,"USD":1,"UYU":29.137648,"UZS":8061.05,"VEF":10.192165,"VND":22730.054895,"VUV":104.859031,"WST":2.513003,"XAF":558.310252,"XAG":0.06020478,"XAU":0.00078718,"XCD":2.70255,"XDR":0.709577,"XOF":558.310252,"XPD":0.00110014,"XPF":101.567839,"XPT":0.00110059,"YER":250.306642,"ZAR":13.738707,"ZMW":9.70615,"ZWL":322.355011}}

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,19 @@ export default function ChallengeHeader(props) {
6262

6363
const phases = {};
6464
allPhases.forEach((phase) => { phases[camelcase(phase.phaseType)] = phase; });
65-
const registrationEnded =
66-
_.get(phases, 'registration.phaseStatus') !== 'Open';
65+
66+
let registrationEndDate;
67+
let registrationEnded = true;
68+
const regPhase = phases.registration;
69+
if (regPhase) {
70+
registrationEndDate = regPhase.actualEndTime || regPhase.scheduledEndTime;
71+
registrationEnded = regPhase.phaseStatus !== 'Open';
72+
}
73+
6774
const submissionEnded =
6875
_.get(phases, 'submission.phaseStatus') !== 'Open' &&
6976
_.get(phases, 'checkpointSubmission.phaseStatus') !== 'Open';
7077

71-
const registrationPhase = allPhases.find(p => p.phaseType === 'Registration');
72-
const registrationEndDate = registrationPhase.actualEndTime
73-
|| registrationPhase.scheduledEndTime;
74-
7578
let trackLower = track ? track.toLowerCase() : 'design';
7679
if (technologies.includes('Data Science')) {
7780
trackLower = 'datasci';
@@ -89,10 +92,11 @@ export default function ChallengeHeader(props) {
8992
}
9093

9194
const hasSubmissions = userDetails && userDetails.hasUserSubmittedForReview;
92-
const nextPhaseIndex = hasRegistered ? 1 : 0;
93-
const nextDeadline = currentPhases.length > 0 && currentPhases[nextPhaseIndex].phaseType;
94-
const deadlineEnd = currentPhases && currentPhases.length > 0 ?
95-
new Date(currentPhases[nextPhaseIndex].scheduledEndTime).getTime() : Date.now();
95+
const nextPhase =
96+
(currentPhases && currentPhases[hasRegistered ? 1 : 0]) || {};
97+
const nextDeadline = nextPhase.phaseType;
98+
const deadlineEnd = nextPhase ?
99+
new Date(nextPhase.scheduledEndTime).getTime() : Date.now();
96100
const currentTime = Date.now();
97101
const timeDiff = deadlineEnd > currentTime ? deadlineEnd - currentTime : 0;
98102
const duration = moment.duration(timeDiff);

0 commit comments

Comments
 (0)