-
Notifications
You must be signed in to change notification settings - Fork 642
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
feat(milestones):add dates to milestones section #6020
Changes from all commits
473d579
e1815fe
e0e689e
e4795b2
a4f6784
96043ea
2efce7d
e0693bd
bb4f8b3
f44f44e
2572a9b
034bfde
e644c96
9174b5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ import CourseLink from '../common/course_link.jsx'; | |
import Affix from '../common/affix.jsx'; | ||
import EditableRedux from '../high_order/editable_redux'; | ||
|
||
import DateCalculator from '../../utils/date_calculator.js'; | ||
import CourseUtils from '../../utils/course_utils.js'; | ||
import CourseDateUtils from '../../utils/course_date_utils.js'; | ||
import { toDate } from '../../utils/date_utils.js'; | ||
|
@@ -26,6 +25,7 @@ const Timeline = createReactClass({ | |
course: PropTypes.object.isRequired, | ||
weeks: PropTypes.array, | ||
allWeeks: PropTypes.array, | ||
allWeeksDates: PropTypes.array, | ||
week_meetings: PropTypes.array, | ||
editableBlockIds: PropTypes.array, | ||
editable: PropTypes.bool, | ||
|
@@ -387,8 +387,7 @@ const Timeline = createReactClass({ | |
if (navIndex === 0) { | ||
navClassName += ' is-current'; | ||
} | ||
|
||
const dateCalc = new DateCalculator(this.props.course.timeline_start, this.props.course.timeline_end, navIndex, { zeroIndexed: true }); | ||
const weekDates = this.props.allWeeksDates; | ||
const navWeekKey = `week-${navIndex}`; | ||
const navWeekLink = `#week-${navIndex + 1 + weeksBeforeTimeline}`; | ||
|
||
|
@@ -397,7 +396,7 @@ const Timeline = createReactClass({ | |
if (usingCustomTitles) { | ||
let navTitle = ''; | ||
if (weekInfo.emptyWeek) { | ||
const datesStr = `${dateCalc.start()} - ${dateCalc.end()}`; | ||
const datesStr = `${weekDates[navIndex].start} - ${weekDates[navIndex].end}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I note that his branch of code is being switched to use weekDates, but another branch below uses dateCalc. Is that the intended/correct behavior? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for pointing this out! I don't recall the exact branch in question, but this is the updated and correct code. The change to weekDates is intentional and reflects the latest update to the logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I mean is, is it intention to switch from dateCalc to weekDates in only one branch, or should it be done in both? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be implemented in only one branch, not both. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other branch is the older one, and I have been working on different changes there. In this branch, I’ve completely rewritten the code, while the other branch continues to focus on the previous changes or issues There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel a little lost here. Why can't the calls to dateCalc in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apologies for any confusion on my end. I currently have two branches in development: one focused on resolving the current issue, and the other working on issue #651. The second branch is entirely separate, and I need to make some changes to it. As a result, I've converted that branch into a draft and have been focusing solely on the first branch for now. Are we on the same page, or is there still some misunderstanding on my part? This is why I've added the weekDates to this branch and not the other branch . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! Sorry, I meant logical branch of the code, as in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the clarification! I’ve updated both the if and else parts as suggested and pushed the changes. Let me know if anything else is needed! 😅👍 |
||
navTitle = I18n.t('timeline.week_number', { number: datesStr }); | ||
} else { | ||
navTitle = weekInfo.title ? weekInfo.title : I18n.t('timeline.week_number', { number: navIndex + 1 + weeksBeforeTimeline }); | ||
|
@@ -411,7 +410,7 @@ const Timeline = createReactClass({ | |
navItem = ( | ||
<li className={navClassName} key={navWeekKey}> | ||
<a href={navWeekLink}>{I18n.t('timeline.week_number', { number: navIndex + 1 + weeksBeforeTimeline })}</a> | ||
<span className="pull-right">{dateCalc.start()} - {dateCalc.end()}</span> | ||
<span className="pull-right">{weekDates[navIndex].start} - {weekDates[navIndex].end}</span> | ||
</li> | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was the only use of DateCalculator, it no longer needs to be imported in the file.