Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 0 additions & 8 deletions src/shared/containers/tc-communities/Loader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ class Loader extends React.Component {
// to see the "Public Site" on Zurich
if (communityId === 'zurich') return Community({ member, meta });
// All other get the not authorized page

console.log('Rendering Access Denied - Not Authenticated for !visitorGroups');
console.log(visitorGroups, meta, communityId, member);

return (
<AccessDenied
cause={ACCESS_DENIED_REASON.NOT_AUTHENTICATED}
Expand All @@ -129,10 +125,6 @@ class Loader extends React.Component {
// to any groups authorized to access this community
return Community({ member, meta });
}

console.log('Rendering Access Denied - Not Authenticated');
console.log(visitorGroups, meta, communityId, member);

/* Visitor is not authorized to access this community. */
return (
<AccessDenied
Expand Down
10 changes: 8 additions & 2 deletions src/shared/utils/challenge-listing/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import moment from 'moment';
* @return {Date}
*/
export function phaseEndDate(phase) {
if (phase.actualEndDate) {
return new Date(phase.actualEndDate);
}
// Case 1: phase is still open. take the `scheduledEndDate`
// Case 2: phase is not open but `scheduledStartDate` is a future date.
// This means phase is not yet started. So take the `scheduledEndDate`
Expand All @@ -17,7 +20,7 @@ export function phaseEndDate(phase) {
return new Date(phase.scheduledEndDate);
}
// for other cases, take the `actualEndDate` as phase is already closed
return new Date(phase.scheduledEndDate || phase.actualEndDate);
return new Date(phase.actualEndDate || phase.scheduledEndDate);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The change in logic from phase.scheduledEndDate || phase.actualEndDate to phase.actualEndDate || phase.scheduledEndDate could potentially alter the behavior of the function. Ensure that this change is intentional and that actualEndDate should indeed take precedence over scheduledEndDate in all scenarios.

}

/**
Expand All @@ -26,12 +29,15 @@ export function phaseEndDate(phase) {
* @return {Date}
*/
export function phaseStartDate(phase) {
if (phase.actualStartDate) {
return new Date(phase.actualStartDate);
}
// Case 1: Phase is not yet started. take the `scheduledStartDate`
if (phase.isOpen !== true && moment(phase.scheduledStartDate).isAfter()) {
return new Date(phase.scheduledStartDate);
}
// For all other cases, take the `actualStartDate` as phase is already started
return new Date(phase.scheduledStartDate || phase.actualStartDate);
return new Date(phase.actualStartDate || phase.scheduledStartDate);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Similar to the change in phaseEndDate, the logic here has been altered from phase.scheduledStartDate || phase.actualStartDate to phase.actualStartDate || phase.scheduledStartDate. Verify that this change is intentional and that actualStartDate should take precedence over scheduledStartDate in all cases.

}

/**
Expand Down