fix: get_subsidy_overview の accepting カウントが常に 0 になるバグを修正 / Fix accepting count always being 0 in get_subsidy_overview#2
Open
sugukurukabe wants to merge 1 commit intodigital-go-jp:mainfrom
Conversation
The 'accepting' bucket in by_deadline_period was always 0 because the
loop only checked acceptance_end_datetime to classify subsidies into
this_month / next_month / after_next_month, but never evaluated whether
acceptance_start_datetime had already passed.
Fix: after confirming end_date is in the future, also check that
acceptance_start_datetime <= now before incrementing 'accepting'.
Fixes the bug where get_subsidy_overview always returned:
"by_deadline_period": { "accepting": 0, ... }
Co-authored-by: Cursor <[email protected]>
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.
問題 / Problem
get_subsidy_overviewの戻り値のby_deadline_period.acceptingが常に0になります。The
by_deadline_period.acceptingfield inget_subsidy_overviewalways returns0.再現手順 / Steps to reproduce
原因 / Root cause
core.pyの集計ループ(L287–L313)ではacceptance_end_datetimeのみを確認し、this_month/next_month/after_next_monthに分類しています。しかしaccepting(現在受付中)を加算するロジックが存在しません。The aggregation loop checks only
acceptance_end_datetimeto classify subsidies intothis_month/next_month/after_next_month, but there is no logic to incrementaccepting(currently open for applications).受付中の判定には両端チェックが必要です。
Determining "currently accepting" requires checking both start and end:
修正 / Fix
acceptance_end_datetimeが未来であることを確認した後、acceptance_start_datetime <= nowを追加でチェックし、acceptingをインクリメントします。After confirming
acceptance_end_datetimeis in the future, also checkacceptance_start_datetime <= nowand incrementaccepting.変更内容 / Changes
jgrants_mcp_server/core.py:get_subsidy_overviewの集計ループにacceptingカウントのロジックを追加(9行追加)テスト / Testing
この修正は
acceptance_start_datetimeが現在以前かつacceptance_end_datetimeが現在以後の補助金データが存在するときにaccepting > 0を返すようになります。With this fix,
accepting > 0will be returned when subsidies haveacceptance_start_datetimein the past andacceptance_end_datetimein the future.JP Bids MCP(sugukurukabe/koko-call-mcp)との連携ガイドを整備する中で発見しました。
Found while writing an integration guide between JP Bids MCP and J-Grants MCP.
Made with Cursor