Skip to content

Commit e7e7467

Browse files
authored
Merge pull request #246 from royshouvik/fix-sorting-issues
Fix incorrect sorting order
2 parents 7a494df + ed6f542 commit e7e7467

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

components/ChallengeCardContainer/sortingFunctionStore.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ const getTimeStamp = dateTime => new Date(dateTime).getTime();
22

33
export default {
44
'Most recent': item => -getTimeStamp(item.submissionEndTimestamp),
5-
'Time to register': item => getTimeStamp(item.registrationEndDate),
5+
'Time to register': item => getTimeStamp(item.registrationEndDate || item.submissionEndDate),
66
'Time to submit': item => item.submissionEndTimestamp,
77
'Phase end time': item => item.currentPhaseRemainingTime,
88
'# of registrants': item => -item.numRegistrants,
99
'# of submissions': item => -item.numSubmissions,
1010
'Prize high to low': item => -item.totalPrize,
11-
'Title A-Z': item => item.challengeName,
11+
'Title A-Z': item => item.name,
1212
'Current phase': item => item.status,
1313
};

components/ChallengeStatus/ChallengeStatus.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ const getTimeLeft = (date, currentPhase) => {
3636
}
3737
const duration = moment.duration(moment(date).diff(moment()));
3838
const h = duration.hours();
39-
const d = duration.days();
39+
const d = duration.asDays();
4040
const m = duration.minutes();
4141
const late = (d < 0 || h < 0 || m < 0);
4242
const suffix = h !== 0 ? 'h' : 'min';
4343
let text = '';
44-
if (d !== 0) text += `${Math.abs(d)}d `;
44+
if (d !== 0) text += `${Math.abs(parseInt(d, 10))}d `;
4545
if (h !== 0) text += `${Math.abs(h)}`;
4646
if (h !== 0 && m !== 0) text += ':';
4747
if (m !== 0) text += `${Math.abs(m)}`;

0 commit comments

Comments
 (0)