optimize ics output file size #68
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Definition
同一课程名 同一上课节次(e.g.1-2节) 每一周的同一天 视为
my_course
(即259行遍历timeArrangement
的i
)优化思路
由于原来的导出文件是把每门课程每一次上课都记为一个
VEVENT
,这样相对臃肿,基于ics的recurrence rule,可以将定期发生(在课程表的情况下就是每周发生)的事件统一记为一个VEVENT
. 即每个my_course
都可以记为1个或若干个含有RRULE
的VEVENT
考虑到如下情况:
学期中间有清明节调课,《初级英语》的课程安排变成了 周三12节(1-8周,10-16周)
因为这两个分段是在一个i的,只要记为两个
VEVENT
,第一个VEVENT
中: {DTSTART
和DTEND
设为1周周三的上课时间(2025.2.19 8:30-10:05)UNTIL
设为8周周三的23:59:59} 第二个VEVENT
中: {DTSTART
和DTEND
设为10周周三的上课时间(2025.4.23 8:30-10:05)UNTIL
设为16周周三的23:59:59}为什么
23:59:59
(Line: 287)因为UNTIL是时间发生的截止时间,因为我担心冲突,所以设置为23:59:59,那么,在当天的23:59:59之前的课都可以发生