feat: 主课表页面体育课程支持地点查看 - #180
Open
clever-max wants to merge 1 commit into
Open
Conversation
Owner
|
1.6.8 再看 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
描述
改进点
SportController,与首页下拉刷新共用同一请求与缓存:不再每次进入页面重复请求、刷新间状态一致。改动文件
lib/controller/sport_controller.dart(新增):体育课程单例 Controller——signal<AsyncState<FetchResult<SportClass>>>状态壳 +_lastValidClass缓存 +sportClassesComputedSignal+SingleFlight防重入的reloadClass()lib/model/xidian_sport/sport_class_table_sync.dart(新增):纯函数mergeSportClassLocations()——把体育课程地点按语义键回填进课表TimeArrangement.classroomlib/controller/classtable_controller.dart:classTableComputedSignal从手写逐字段复制改为调用mergeSportClassLocations合并体育地点后输出lib/controller/homepage_controller.dart:首页刷新任务列表注册SportController.i.reloadClasslib/page/sport/sport_class_window.dart:三处SportSession().getClass()直连改为SportController.i.reloadClass()(首载 / 下拉刷新 / 错误重试)test/repository/xidian_sport/sport_class_table_sync_test.dart(新增):合并函数的纯逻辑单测pubspec.yaml:html约束^0.15.4→'>=0.15.5 <0.15.7'改动点与意图
SportClassItem.place填到匹配的课表TimeArrangement.classroom;仅当该项教室为空、学期一致、老师&起始节次&周几唯一匹配时才回填 → 避免同教师多场地时错误归属,且不覆盖教务已给的地点。ClassTableData并拷贝timeArrangement(仅改 classroom)→ 合并不污染缓存中的原课表对象(测试断言 source 保持 classroom 为空)。SportSession"(项目文档记录的例外模块之一);本次为满足"首页刷新与课表合并都需要体育课程数据",引入最小单例 Controller 统一请求/缓存 → 消除多入口各自请求、状态不一致。classTableComputedSignal依赖sportClassesComputedSignal→ 体育课程刷新后课表教室自动更新(signals 计算链)。pubspec.yaml的html约束收窄与体育功能无直接关系:为构建兼容而收紧,若确为上游/依赖问题建议另开提交或直接修改,避免与功能改动混在同一 PR。测试结果
sport_class_table_sync_test)Q: 不知道有没有必要在首页刷新状态中增加体育课状态刷新,不过此功能使用频率较低且不知是否会引入UI溢出问题