複数プランの電気料金を計算するAPI機能を作成#6
Merged
chanchan-co merged 10 commits intoOct 22, 2025
Merged
Conversation
added 10 commits
October 21, 2025 20:17
chanchan-co
deleted the
feature/generate_electricity_charge_calculate_func
branch
October 22, 2025 12:45
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.
概要
やったこと
確認事項
make upmake web-bashrails db:migrate:reset db:seed使用量(kWh)0の確認
レスポンス
2段階の従量料金区分の確認
レスポンス
3段階の従量料金区分の確認
レスポンス
エラーハンドリングの確認
パラメータ不足
不正な値
補足
jqを利用していますが、jqが未インストールの方は| jqを削除してください。電気料金 端数 電力会社と調べると円未満切り捨てと業界ルールを見つけたので計算ロジックの途中の計算では端数を入れた状態で計算をして合計金額に対して
floorで端数を切り捨てております。Planモデルなどに計算処理を作成すると電気以外のドメイン要件が発生した時に剥がしにくい、計算ロジック分散のリスク、テストのしやすさなどを考えてサービスクラスを作成しております。