Skip to content

feat(profile): 创建临时层课表时支持同时创建临时时间表#1781

Merged
HelloWRC merged 7 commits into
ClassIsland:masterfrom
Chineseshuaji:feat/temp-timelayout-overlay
May 16, 2026
Merged

feat(profile): 创建临时层课表时支持同时创建临时时间表#1781
HelloWRC merged 7 commits into
ClassIsland:masterfrom
Chineseshuaji:feat/temp-timelayout-overlay

Conversation

@Chineseshuaji

@Chineseshuaji Chineseshuaji commented May 1, 2026

Copy link
Copy Markdown
Contributor

概述

在创建临时层课表时,新增"同时创建临时时间表"选项。勾选后,临时层课表将获得独立的时间表副本,对时间表的修改不会影响源时间表。

变更内容

  • TimeLayout 模型新增 IsOverlay 和 OverlaySourceId 属性,用于标记临时时间表
  • ProfileService.CreateTempClassPlan 新增重载方法,支持 createTempTimeLayout 参数
  • IPublicProfileService 新增重载方法,保持对现有插件的二进制兼容
  • 创建临时层弹出层新增"同时创建临时时间表"复选框
  • CleanExpiredTempClassPlan 自动清理孤立的临时时间表
  • ConvertToStdClassPlan 同步转换关联的临时时间表

检查清单

  • 我已经在本地测试过这个 PR,确保欲实现的功能或修复的问题能正常工作

关联 Issue

#1783

🤝 关于反馈

我是第一次提交PR,对项目架构还不够熟悉。
任何问题都欢迎直接指出——我会认真看每条评论。
如果可以的话,麻烦在指出问题时:

  • 顺手贴一下相关文档或示例代码的位置
  • 或者告知搜索什么关键词能自己找到答案

提前感谢花时间review 🙏

@Chineseshuaji Chineseshuaji requested review from a team and HelloWRC as code owners May 1, 2026 09:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 333b44f783

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}

public async void Open(Uri? uri = null)
public async void Open()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore URI-based tab routing in profile settings open path

Changing Open to take no Uri and removing the segment-based tab selection breaks app URI navigation for profile subpages. The app still routes profile links with a URI (App.axaml.cs line 872 via MainWindow.OpenProfileSettingsWindow(Uri?)), so links like /profile/timelayouts will no longer land on the requested tab and can only open whatever tab was previously selected.

Useful? React with 👍 / 👎.

Comment on lines 170 to 172
e.Cancel = true;
_isOpen = false;
ViewModel.ProfileService.SaveProfile();
Hide();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Save profile before hiding the editor window

The non-shutdown close path now just cancels and hides the window, but no longer persists the profile first. This risks losing recent edits if the process exits unexpectedly before another explicit save, because profile autosave is wired to Profile.PropertyChanged and many class/time-table edits mutate nested objects rather than raising a top-level profile change.

Useful? React with 👍 / 👎.

@HelloWRC HelloWRC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请回滚 ProfileSettingsWindow.xaml[.cs] 中所有无关更改和所有 SentrySdk 用法的更改。

请修复所有的编译错误,并确保应用能正常编译并运行。

如果您持续提交此类低质量 PR,我们可能会临时或永久限制您向本仓库提交补丁的能力。

Comment thread ClassIsland.Shared.IPC/Abstractions/Services/IPublicProfileService.cs Outdated
@Chineseshuaji Chineseshuaji changed the title feat(profile): create temp time layout alongside temp class plan feat(profile): 创建临时层课表时支持同时创建临时时间表 May 1, 2026
@Chineseshuaji Chineseshuaji requested a review from HelloWRC May 1, 2026 12:40
@Chineseshuaji

Copy link
Copy Markdown
Contributor Author

在本地编译成功,可以正常运行,请提供您的意见

Chineseshuaji and others added 5 commits May 1, 2026 23:35
- Add IsOverlay and OverlaySourceId properties to TimeLayout
- Add createTempTimeLayout parameter to CreateTempClassPlan
- Add checkbox in flyout: create temp time layout together
- CleanExpiredTempClassPlan auto-cleans orphaned temp time layouts
- ConvertToStdClassPlan converts associated temp time layout too
- Revert ProfileSettingsWindow Open/Close changes (separate PR)
- Revert MainWindow and App.axaml URI routing changes (separate PR)
- Use method overload instead of default parameter in IPublicProfileService
- Keep only temp time layout creation feature
- 回滚 ProfileSettingsWindow.axaml/.cs 到上游版本,仅加 CheckBox + 参数传递
- 回滚 ViewModel 无关属性,仅保留 TempOverlayCreateTimeLayout
- 回滚 SentrySdk EmitCounter -> Increment 的 API 变更
- 回滚 Weather/Plugins/Toast 等 15 个无关文件变更
- 核心功能完整保留:IsOverlay、CreateTempClassPlan(createTempTimeLayout)、清理逻辑
@Chineseshuaji Chineseshuaji force-pushed the feat/temp-timelayout-overlay branch from 126e5ac to 729515a Compare May 1, 2026 15:37
@Chineseshuaji

Copy link
Copy Markdown
Contributor Author

已经进行重构,确保符合要求

Comment thread ClassIsland/Services/ProfileService.cs Outdated
}

var activeTimeLayoutIds = Profile.ClassPlans.Values
.Where(x => !x.IsOverlay || orderedSchedules.Contains(GetKey(x)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处应该直接对 ClassPlans 字典进行查询,这样查询时可以直接从 x 中同时获取到对应课表的值和 Guid 键,无需再引入 GetKey 方法进行查询,以降低时间复杂度。

/// <summary>
/// 创建临时层课表,并可选择同时创建临时时间表。如果已经存在临时层课表,则本方法不起作用。
/// </summary>
Guid? CreateTempClassPlan(Guid id, Guid? timeLayoutId, DateTime? enableDateTime, bool createTempTimeLayout);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处应该补充参数 XML 文档。

@Chineseshuaji Chineseshuaji May 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,我立即修改,感谢您的建议

- 将 CleanExpiredTempClassPlan 中 ClassPlans.Values 遍历改为字典直接迭代,移除 GetKey 辅助方法。- 为 IPublicProfileService.CreateTempClassPlan(4参数) 重载补充 XML 文档注释。
@Chineseshuaji Chineseshuaji force-pushed the feat/temp-timelayout-overlay branch from dfae432 to 9d391a5 Compare May 2, 2026 12:20
@Chineseshuaji Chineseshuaji requested a review from HelloWRC May 2, 2026 12:24
@Chineseshuaji

Copy link
Copy Markdown
Contributor Author
-2026-05-02-202931.mp4

这是测试后的效果

@HelloWRC HelloWRC merged commit 044e773 into ClassIsland:master May 16, 2026
2 checks passed
@HelloWRC

Copy link
Copy Markdown
Member

感谢您的贡献🤝

昔涟 爱

@HelloWRC

Copy link
Copy Markdown
Member

@all-contributors please add @Chineseshuaji for code

@allcontributors

Copy link
Copy Markdown
Contributor

@HelloWRC

I've put up a pull request to add @Chineseshuaji! 🎉

Koharu-Mizuki pushed a commit to Koharu-Mizuki/ClassIsland-RB that referenced this pull request May 24, 2026
* feat(profile): create temp time layout alongside temp class plan

- Add IsOverlay and OverlaySourceId properties to TimeLayout
- Add createTempTimeLayout parameter to CreateTempClassPlan
- Add checkbox in flyout: create temp time layout together
- CleanExpiredTempClassPlan auto-cleans orphaned temp time layouts
- ConvertToStdClassPlan converts associated temp time layout too

* fix: revert unrelated changes, use method overload for binary compat

- Revert ProfileSettingsWindow Open/Close changes (separate PR)
- Revert MainWindow and App.axaml URI routing changes (separate PR)
- Use method overload instead of default parameter in IPublicProfileService
- Keep only temp time layout creation feature

* style: remove consecutive blank lines (SA1507)

* style: remove all consecutive blank lines (SA1507)

* fix: 移除无关更改,仅保留临时层时间表核心功能

- 回滚 ProfileSettingsWindow.axaml/.cs 到上游版本,仅加 CheckBox + 参数传递
- 回滚 ViewModel 无关属性,仅保留 TempOverlayCreateTimeLayout
- 回滚 SentrySdk EmitCounter -> Increment 的 API 变更
- 回滚 Weather/Plugins/Toast 等 15 个无关文件变更
- 核心功能完整保留:IsOverlay、CreateTempClassPlan(createTempTimeLayout)、清理逻辑

* fix: 按审查意见修复临时时间表查询效率与文档注释

- 将 CleanExpiredTempClassPlan 中 ClassPlans.Values 遍历改为字典直接迭代,移除 GetKey 辅助方法。- 为 IPublicProfileService.CreateTempClassPlan(4参数) 重载补充 XML 文档注释。

---------

Co-authored-by: Chineseshuaji <chineseshuaji@github.com>
@HelloWRC HelloWRC linked an issue May 28, 2026 that may be closed by this pull request
5 tasks
Koharu-Mizuki pushed a commit to Koharu-Mizuki/ClassIsland-RB that referenced this pull request Jun 19, 2026
* feat(profile): create temp time layout alongside temp class plan

- Add IsOverlay and OverlaySourceId properties to TimeLayout
- Add createTempTimeLayout parameter to CreateTempClassPlan
- Add checkbox in flyout: create temp time layout together
- CleanExpiredTempClassPlan auto-cleans orphaned temp time layouts
- ConvertToStdClassPlan converts associated temp time layout too

* fix: revert unrelated changes, use method overload for binary compat

- Revert ProfileSettingsWindow Open/Close changes (separate PR)
- Revert MainWindow and App.axaml URI routing changes (separate PR)
- Use method overload instead of default parameter in IPublicProfileService
- Keep only temp time layout creation feature

* style: remove consecutive blank lines (SA1507)

* style: remove all consecutive blank lines (SA1507)

* fix: 移除无关更改,仅保留临时层时间表核心功能

- 回滚 ProfileSettingsWindow.axaml/.cs 到上游版本,仅加 CheckBox + 参数传递
- 回滚 ViewModel 无关属性,仅保留 TempOverlayCreateTimeLayout
- 回滚 SentrySdk EmitCounter -> Increment 的 API 变更
- 回滚 Weather/Plugins/Toast 等 15 个无关文件变更
- 核心功能完整保留:IsOverlay、CreateTempClassPlan(createTempTimeLayout)、清理逻辑

* fix: 按审查意见修复临时时间表查询效率与文档注释

- 将 CleanExpiredTempClassPlan 中 ClassPlans.Values 遍历改为字典直接迭代,移除 GetKey 辅助方法。- 为 IPublicProfileService.CreateTempClassPlan(4参数) 重载补充 XML 文档注释。

---------

Co-authored-by: Chineseshuaji <chineseshuaji@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(功能建议)可启用临时时间表

2 participants