Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

複数配送時に在庫数が減らない不具合を修正 #4588

Merged
merged 2 commits into from Jun 26, 2020
Merged

複数配送時に在庫数が減らない不具合を修正 #4588

merged 2 commits into from Jun 26, 2020

Conversation

belltzel
Copy link
Contributor

@belltzel belltzel commented Jun 24, 2020

概要(Overview・Refs Issue)

#4578

方針(Policy)

複数配送の場合、同じProductClassのOrderItemが複数出来上がる場合があるので、2度目以降の在庫計算の際にrefreshで在庫数の計算が無かった事になってます。
lockとrefreshを一度だけ行うようにしています。

実装に関する補足(Appendix)

ProductStockのEntity「private $product_class_id」は使用されてる箇所が無いかと思います。
このproduct_class_idを利用して2度目以降のProductClassが同じだった場合を判別してます。

テスト(Test)

相談(Discussion)

product_class_id使わず、チェック用の配列用意でも良かったような。
スマートな方法が知りたいです。

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更
  • フックポイントの呼び出しタイミングの変更
  • フックポイントのパラメータの削除・データ型の変更
  • twigファイルに渡しているパラメータの削除・データ型の変更
  • Serviceクラスの公開関数の、引数の削除・データ型の変更
  • 入出力ファイル(CSVなど)のフォーマット変更

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか

@okazy okazy added this to the 4.0.x milestone Jun 24, 2020
@okazy okazy added bug:High and removed bug:Middle labels Jun 25, 2020
@okazy
Copy link
Contributor

okazy commented Jun 25, 2020

@belltzel
修正ありがとうございます。
修正内容問題ないと思います。

product_class_id をフラグのように利用していることに違和感はありますが、ちゃんと実装しようとすると修正箇所が多くなってしまいそうなので、この修正で問題ないかと思います。

できればUnitテストを追加しておきたいのですが、追加していただくことは可能でしょうか?
/tests ディレクトリにUnitテストのコードが入っています。
その中で、今回変更いただいた StockReduceProcessor は以下のファイルにテストが書かれています。

https://github.com/EC-CUBE/ec-cube/blob/4.0/tests/Eccube/Tests/Service/PurchaseFlow/Processor/StockReduceProcessorTest.php

Copy link
Contributor

@okazy okazy left a comment

Choose a reason for hiding this comment

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

テスト追加ありがとうございます。内容問題ないと思います。

@chihiro-adachi chihiro-adachi merged commit 9e24a29 into EC-CUBE:4.0 Jun 26, 2020
@chihiro-adachi
Copy link
Contributor

@belltzel
マージしました。ありがとうございました!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants