月をまたぐ連勤:前月の末尾を写す日数が足りず、上限を上げると違反を見逃す

Open
#233 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 12 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, testing

Research direction

Start by reading feature/precedingMonth.ts around capturePrecedingTail and precedingTailLengthFor, then trace how the captured tail feeds MaxConsecutiveWorkdaysConstraint and the streak line described in #227. Add coverage for raising the limit after capture and for exact streak wording, including a fully worked previous month. Define how existing schedules with seven captured days are handled; done means the new behavior and table column count are covered by tests.

Written by the indexing model from the issue text.

Description

Shiftonton

背景

#218 で、今月の勤務表は参照レポート(前月の確定)の月末から続くようになった。連勤制約(MaxConsecutiveWorkdaysConstraint)は、前月末から続く出勤を今月1日からの連勤に足す。

前月の末尾は、勤務表を作るとき(または参照レポートを付け替えるとき)に max(7, 連勤上限) 日だけ 写される(feature/precedingMonth.ts の capturePrecedingTail → precedingTailLengthFor)。あとから連勤上限を変えても、写した日数は変わらない。

問題

前月末に10連勤 → 今月1日も出勤(本当は11連勤)のとき:

上限 写したときの上限 写した日数 持ち越し 判定
5 5 7 7 違反「8連勤」 ← 本当は11連勤
9 5 7 7 違反なし ← 見逃し
9 9 9 9 違反「10連勤」 ← 本当は11連勤
  1. 上限を上げると違反を見逃す。 写したのが7日なら持ち越しは最大7日。上限を8以上にすると、月をまたぐ連勤が上限を超えていても違反にならない(制約バブルの停止バーのドラッグや数の入力で、上限はその場で変えられる)
  2. 見つけても日数を少なく言う。 写した日数より前から続く連勤は数えられないので、違反の文の「N連勤」が本当より短い。連勤の線(#227)も同じ数え方なので、同じだけ短く出る

なお、次は正しく動いている(確かめ済み):

  • 前月の末尾は、本当に直前の月のときだけつながる(withPrecedingTail が directlyPrecedes で確かめる)
  • 今月1日が休み・未定なら持ち越さない
  • 自動シフトの判定キャッシュ(placementCheck.ts)は、キーに前月の末尾の中身を入れている

方針(案)

前月を丸ごと写す(length を前月の日数にする)。

  • 30日 × 人数ぶんの小さなデータなので重さは問題にならない
  • 上限をいくつに変えても、写し直さずに正しく判定できる
  • 残るのは「前月がまるごと出勤だった」ときだけ。そのときは「前月から N連勤以上」と書けば嘘にならない
  • 表に並べる前月の列(今は7日以上)は、写す日数とは分けて決める(全部並べると表が横に長くなる)

やること

  • capturePrecedingTail で前月を丸ごと写す(precedingTailLengthFor を見直す)
  • 表の前月の列の数を、写した日数と分けて決める
  • 前月がまるごと出勤だったときの違反の文を「N連勤以上」にする
  • すでに作った勤務表(7日ぶんで写したもの)の扱いを決める(参照レポートを付け替えれば写し直されるので、それで足りるか)
  • テスト:写した後に上限を上げても違反を見逃さない/違反の文の日数が本当の連勤と一致する

関連

  • #218 参照レポート(前月の確定)の月末から、今月の勤務表を続ける
  • #231 勤務表は、前月の確定版から引き継いで始まる
  • #227 連勤・連休の見える化(連勤の線も前月の末尾から数える)
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
9d 13h
Merged PRs (30d)
10

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fumicode/bublys-org

All issues in fumicode/bublys-org

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.