Last active
October 29, 2015 17:25
-
-
Save mdonati/7906e671694f3b82b3d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func addSectionToTimeline(sectionInfo: OverviewSectionInfo, dateFormat: String, inout dates: [String], inout keyDate: String) { | |
let dateFormat = "MMM d" | |
let dateString = sectionInfo.entity.displayDate.dateString(dateFormat) | |
if (dateString != keyDate) { | |
keyDate = dateString | |
dates.append(dateString) | |
} | |
if (sectionInfo.isOpen) { | |
for activity in sectionInfo.activities { | |
let activityDate = activity.displayStartDate!.dateString(dateFormat) | |
if (activityDate != keyDate) { | |
if (sectionInfo.isOpen) { | |
keyDate = activityDate | |
self.timeline[activity.primaryKey] = [activityDate] | |
} else { | |
dates.append(activityDate) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment