Skip to content

Conversation

@yas-ako
Copy link
Contributor

@yas-ako yas-ako commented Jun 30, 2025

User description

#461 を修正
プロジェクト新規作成の際にメンバーを登録すると、メンバーの参加時期のデフォルトの値が、現在の年の前期になっている。これを、プロジェクトの開始時期に変更する。


PR Type

Bug fix


Description

  • プロジェクト新規作成時のメンバー加入時期を修正

  • 既存実装は現在年の前期を初期値としていた

  • プロジェクト開始時期(formValues.duration.since)を使用


Changes walkthrough 📝

Relevant files
Bug fix
ProjectNew.vue
メンバー加入時期の初期値変更                                                                                     

src/pages/ProjectNew.vue

  • duration.sinceの初期値にformValues.duration.sinceを使用
  • new Date()semesterのデフォルト設定を削除
  • untilは従来通りundefined
  • +1/-4     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @Pugma Pugma requested a review from Copilot June 30, 2025 16:07
    Copy link
    Contributor

    Copilot AI left a comment

    Choose a reason for hiding this comment

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

    Pull Request Overview

    This PR updates the default join date for new project members to use the project’s start date (formValues.duration.since) instead of defaulting to the current year’s first semester.

    • Removed hardcoded new Date().getFullYear() and semester: 0
    • Now reuses formValues.duration.since for since in userWithDurations
    Comments suppressed due to low confidence (1)

    src/pages/ProjectNew.vue:95

    • Add a unit test verifying that new members inherit the project’s start date as their default join date, ensuring this behavior remains correct in future changes.
          since: formValues.duration.since,
    

    Copy link
    Collaborator

    @Pugma Pugma left a comment

    Choose a reason for hiding this comment

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

    一点だけコメントを付けました!
    確認をお願いします

    year: new Date().getFullYear(),
    semester: 0
    },
    since: formValues.duration.since,
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    copilot や agent などにも指摘されていますが、オブジェクトをそのまま代入すると参照型になると思います
    値のコピーをするために内部のプリミティブな要素を展開するようにしたほうがいいと思います

    agent の方で指摘されている null 合体演算子によるフォールバックについては、ここではしてもしなくても良いかと思います

    @Pugma
    Copy link
    Collaborator

    Pugma commented Jun 30, 2025

    あと、 fix #461 みたいな書き方をすると PR がマージされたときに自動で issue を close できます
    次回以降使ってみてください〜

    参考 ↓↓↓
    https://docs.github.com/ja/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue

    @Pugma
    Copy link
    Collaborator

    Pugma commented Jul 1, 2025

    /improve

    @github-actions
    Copy link
    Contributor

    github-actions bot commented Jul 1, 2025

    PR Code Suggestions ✨

    Latest suggestions up to ab8640a

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    未定義時のデフォルト設定


    formValues.duration.sinceが未定義の場合に現在の年度と学期をデフォルトで設定するガードを追加してください。これにより、意図しないundefined参照を防ぎます。

    src/pages/ProjectNew.vue [95]

    -since: { ...formValues.duration.since },
    +since: { ...(formValues.duration.since ?? { year: new Date().getFullYear(), semester: 0 }) },
    Suggestion importance[1-10]: 6

    __

    Why: The nullish coalescing guard ensures formValues.duration.since falls back to the previous default { year, semester }, preventing potential undefined errors without changing the intended behavior.

    Low

    Previous suggestions

    Suggestions up to commit 4272b7a
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    共有オブジェクトのクローン化


    formValues.duration.sinceのオブジェクトをそのまま参照すると、各ユーザー間で同一の参照が共有され、意図せず全員の期間がまとめて変更される可能性があります。スプレッド構文でクローンを作成し、各ユーザーに独立したオブジェクトを割り当てましょう。

    src/pages/ProjectNew.vue [95]

    -since: formValues.duration.since,
    +since: { ...formValues.duration.since },
    Suggestion importance[1-10]: 7

    __

    Why: Using formValues.duration.since directly can cause all user durations to share the same object reference, so cloning ensures each user gets an independent copy.

    Medium
    General
    デフォルト期間のフォールバック設定


    formValues.duration.sinceが未定義の場合にエラーになるのを防ぐため、デフォルト値をフォールバックで設定しましょう。プロジェクト開始時期が必ず設定されるようにします。

    src/pages/ProjectNew.vue [95]

    -since: formValues.duration.since,
    +since: formValues.duration.since ?? { year: new Date().getFullYear(), semester: 0 },
    Suggestion importance[1-10]: 5

    __

    Why: Adding a nullish coalescing fallback prevents errors if formValues.duration.since is undefined, but in most cases this value should already be set by the form.

    Low

    Copy link
    Collaborator

    @Pugma Pugma left a comment

    Choose a reason for hiding this comment

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

    ありがとうございます!
    現状の実装で大丈夫そうです!
    merge しちゃってください

    @yas-ako
    Copy link
    Contributor Author

    yas-ako commented Jul 1, 2025

    了解です
    レビューありがとうございました!

    @yas-ako yas-ako merged commit fc87955 into main Jul 1, 2025
    11 checks passed
    @yas-ako yas-ako deleted the fix/set-join-date-as-project-start branch July 1, 2025 06:26
    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.

    プロジェクト新規作成時にメンバーの加入時期のデフォルト値をプロジェクト開始時期にする

    3 participants