Repository navigation
fix: 調課後重新發布課表,補課那一節接到新課表;發布 v1.4.18 - #83
Merged
Merged
Conversation
組長回報:調課後又改課表重新發布,週課表只有請假那一格變紅,補課那格變回原本的課。 調課記的是「舊課表的哪一格」,新課表每一格都是新的,於是週課表、教師週總表、巡堂表、 即時概況都畫不出補課那一節,調課清單也以為那一節還能再拿去調(可能重複調課)。 - 發布時把這學期的調課接到新課表「同一門課、同一天、涵蓋那一節」的格子(swap_relink) - 接不上的(那堂課被搬走)發布後回報筆數 swap_unlinked,前端提醒組長撤回重排 - alembic 0020_relink_swaps:升級時用同一套規則修正既有資料,只改資料不改資料表 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
摘要
LINE 社群組長回報:週四第五節和週三第六節對調後,週課表只有週四那格變紅,週三補課那格變回原本的課。v1.4.17 以為是補課在別週,其實是程式錯誤:調課之後重新發布課表,補課那一節就對不上了。
原因
調課記下補課那一節時記的是「課表的哪一格」(
Substitution.swap_entry_id)。發布新課表時新課表每一格都是新的一列、舊課表封存,補課那一節還指著舊課表的格子。結果:_taken_slots比對格子編號),同一節可能再換給別人。請假那一節用「配課 + 節次」記,不受影響,所以只有一半壞掉。
修改
services/swap_relink.py:發布時把這學期的調課接到新課表「同一門課(配課)、同一天、涵蓋那一節」的格子。新課表把那堂課搬走、接不上的不猜,維持原樣。swap_unlinked(今天以後、仍有效、接不上的調課筆數),「版本與發布」頁提醒組長到「調代課處理」撤回重排。alembic 0020_relink_swaps:只改資料、不改資料表,升級時用同一套規則把既有調課接回目前已發布的課表(結構升級流程會先自動備份)。測試
test_swap_relink_v1418.py4 項:重新發布後補課那格照常顯示(班級與教師週課表)、同一節不會再被拿去調、那堂課被搬走時回報筆數、升級腳本修正既有資料且重跑不會重複改。拿掉修正時前兩項會失敗。relink,2 筆接上、重跑 0 筆,再退回交易。🤖 Generated with Claude Code