Skip to content

Commit 024b3f4

Browse files
committed
revert schedule update in cd65d98
1 parent 5cc3987 commit 024b3f4

File tree

2 files changed

+62
-58
lines changed

2 files changed

+62
-58
lines changed

app/util/schedule.js

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -118,62 +118,61 @@ module.exports = {
118118
const currSectionData = currCourse.section_data
119119
for (let k = 0; k < currSectionData.length; ++k) {
120120
const currData = currSectionData[k]
121-
// Only show classes without a special meeting code (i.e. 'FI', 'PB', etc)
122-
if (currData.special_mtg_code === '') {
123-
// time format is HH:MM - HH:MM
124-
// split time string and get seconds
125-
const timeString = currData.time
126-
let startSeconds,
127-
endSeconds,
128-
formattedTimeString,
129-
formattedStartString
130-
131-
if (timeString) {
132-
const timeArr = timeString.split(' ')
133-
const startString = timeArr[0]
134-
const endString = timeArr[2]
135-
const startArr = startString.split(':') // split it at the colons
136-
const endArr = endString.split(':') // split it at the colons
137-
// minutes are worth 60 seconds. Hours are worth 60 minutes.
138-
startSeconds = (+startArr[0] * 60 * 60) + (+startArr[1] * 60)
139-
endSeconds = (+endArr[0] * 60 * 60) + (+endArr[1] * 60)
140-
const startMoment = moment(startString, 'HH:mm')
141-
const endMoment = moment(endString, 'HH:mm')
142-
const startAm = Boolean(startMoment.format('a') === 'am')
143-
const endAm = Boolean(endMoment.format('a') === 'am')
144-
formattedStartString = moment(startString, 'HH:mm').format('h:mm') +
145-
(startAm ? (' a.m.') : (' p.m.'))
146-
const formattedEndString = moment(endString, 'HH:mm').format('h:mm') +
147-
(endAm ? (' a.m.') : (' p.m.'))
148-
formattedTimeString = formattedStartString +
149-
' – ' + formattedEndString
150-
}
151-
152-
let day = 'OTHER'
153-
if (currData.days) {
154-
day = currData.days
155-
}
156-
157-
const item = {
158-
building: currData.building,
159-
room: currData.room,
160-
instructor_name: currData.instructor_name,
161-
section: currData.section,
162-
subject_code: currCourse.subject_code,
163-
course_code: currCourse.course_code,
164-
course_title: currCourse.course_title,
165-
time_string: formattedTimeString,
166-
start_string: formattedStartString,
167-
start_time: startSeconds,
168-
end_time: endSeconds,
169-
meeting_type: currData.meeting_type,
170-
special_mtg_code: currData.special_mtg_code,
171-
day_code: currData.days,
172-
grade_option: currCourse.grade_option
173-
}
174-
175-
courseItems[day].push(item)
121+
122+
// if (currData.special_mtg_code === '') {
123+
// time format is HH:MM - HH:MM
124+
// split time string and get seconds
125+
const timeString = currData.time
126+
let startSeconds,
127+
endSeconds,
128+
formattedTimeString,
129+
formattedStartString
130+
131+
if (timeString) {
132+
const timeArr = timeString.split(' ')
133+
const startString = timeArr[0]
134+
const endString = timeArr[2]
135+
const startArr = startString.split(':') // split it at the colons
136+
const endArr = endString.split(':') // split it at the colons
137+
// minutes are worth 60 seconds. Hours are worth 60 minutes.
138+
startSeconds = (+startArr[0] * 60 * 60) + (+startArr[1] * 60)
139+
endSeconds = (+endArr[0] * 60 * 60) + (+endArr[1] * 60)
140+
const startMoment = moment(startString, 'HH:mm')
141+
const endMoment = moment(endString, 'HH:mm')
142+
const startAm = Boolean(startMoment.format('a') === 'am')
143+
const endAm = Boolean(endMoment.format('a') === 'am')
144+
formattedStartString = moment(startString, 'HH:mm').format('h:mm') +
145+
(startAm ? (' a.m.') : (' p.m.'))
146+
const formattedEndString = moment(endString, 'HH:mm').format('h:mm') +
147+
(endAm ? (' a.m.') : (' p.m.'))
148+
formattedTimeString = formattedStartString +
149+
' – ' + formattedEndString
150+
}
151+
152+
let day = 'OTHER'
153+
if (currData.days) {
154+
day = currData.days
176155
}
156+
157+
const item = {
158+
building: currData.building,
159+
room: currData.room,
160+
instructor_name: currData.instructor_name,
161+
section: currData.section,
162+
subject_code: currCourse.subject_code,
163+
course_code: currCourse.course_code,
164+
course_title: currCourse.course_title,
165+
time_string: formattedTimeString,
166+
start_string: formattedStartString,
167+
start_time: startSeconds,
168+
end_time: endSeconds,
169+
meeting_type: currData.meeting_type,
170+
special_mtg_code: currData.special_mtg_code,
171+
day_code: currData.days,
172+
grade_option: currCourse.grade_option
173+
}
174+
175+
courseItems[day].push(item)
177176
}
178177
}
179178

app/views/schedule/FullScheduleListView.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ class FullSchedule extends React.Component {
6060
)
6161
}
6262

63-
renderItem = ({ item, index, section }) => (
64-
<IndividualClass data={item} props={this.props} />
65-
)
63+
renderItem = ({ item, index, section }) => {
64+
// Only show classes without a special meeting code (i.e. 'FI', 'PB', etc)
65+
if (!item.special_mtg_code) {
66+
return (<IndividualClass data={item} props={this.props} />)
67+
} else {
68+
return null
69+
}
70+
}
6671

6772
render() {
6873
return (

0 commit comments

Comments
 (0)