-
Notifications
You must be signed in to change notification settings - Fork 0
Implement low-risk maintainability improvements to quote_script.gs #133
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
Open
devin-ai-integration
wants to merge
8
commits into
master
Choose a base branch
from
devin/1753323015-low-risk-maintainability-improvements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Implement low-risk maintainability improvements to quote_script.gs #133
devin-ai-integration
wants to merge
8
commits into
master
from
devin/1753323015-low-risk-maintainability-improvements
Conversation
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
- Update Set_trial_comments class to use ConfigCache instead of direct PropertiesService calls - Convert var declarations to const/let for better variable scoping - Extract magic numbers (1.5, 1, 50) into named constants in QuoteScriptConstants - Improve code readability and maintainability while preserving all functionality Co-Authored-By: [email protected] <[email protected]>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Test 医師主導治験 with table count 49 (should adjust to 50) - Test 医師主導治験 with table count 51 (should remain 51) - Test non-医師主導治験 with table count 49 (should remain 49) - Verify trial comment generation for table count adjustments - Include edge cases and boundary conditions for robust testing Co-Authored-By: [email protected] <[email protected]>
- Test 営利企業原資(製薬企業等) with coefficient 1.5 and clinical trials office flag ON - Test 公的資金(税金由来) with coefficient 1.0 and clinical trials office flag OFF - Verify coefficient calculation logic in quote_script.gs - Test clinical trials office flag logic in SetSheetItemValues class - Include comprehensive scenarios combining funding source with different trial types - Add quick test runner for development and debugging Co-Authored-By: [email protected] <[email protected]>
…ource_ and adjustFinalAnalysisTableCount_ - Implement calculateCoefficientFromFundingSource_ to determine coefficient based on funding source - Implement adjustFinalAnalysisTableCount_ to adjust table count for investigator-initiated trials - Functions were already being called but definitions were missing, causing runtime errors - Improves testability by separating logic into dedicated functions Co-Authored-By: [email protected] <[email protected]>
…unction - Modified testCoefficientCalculation_ to call the extracted function directly - Removes code duplication and ensures tests validate the actual implementation - Improves test reliability and maintainability Co-Authored-By: [email protected] <[email protected]>
- Enhanced calculateCoefficientFromFundingSource_ to check G2, AQ2, and AN2 in priority order - G2 (試験種別) = '医師主導治験' → 1.5 (highest priority) - AQ2 (調整事務局設置) = 'あり' → 1.5 (medium priority) - AN2 (原資) = '営利企業原資(製薬企業等)' → 1.5 (lowest priority) - Updated test scenarios to cover all coefficient calculation rules - Added comprehensive mock data generation for multi-condition testing Co-Authored-By: [email protected] <[email protected]>
Contributor
Author
|
Closing due to inactivity for more than 7 days. Configure here. |
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.
Enhance Maintainability: Extract Functions and Implement Comprehensive Coefficient Logic
Summary
This PR implements the Single Responsibility Principle by extracting complex logic into dedicated, testable functions in
quote_script.gs. The main improvements include:Function Extraction: Added missing definitions for
calculateCoefficientFromFundingSource_andadjustFinalAnalysisTableCount_functions that were being called but not defined (causing runtime errors)Enhanced Coefficient Logic: Implemented comprehensive coefficient calculation rules with proper priority order:
Comprehensive Test Coverage: Updated
test_funding_source_logic.gswith 7 test scenarios covering all coefficient calculation rules and edge casesPrevious Maintainability Improvements: Includes trial period processing extraction, ConfigCache implementation, and constants consolidation
Review & Testing Checklist for Human
🔴 High Priority (Critical Business Logic)
quote_script_main()) end-to-end to ensure no regressions and that coefficients are applied correctly to pricing calculations🟡 Medium Priority (Integration & Edge Cases)
testFundingSourceLogic()and verify all 7 scenarios pass with expected coefficientsRecommended Test Plan
testFundingSourceLogic()in Google Apps Script console and verify all tests passquote_script_main()with sample Quotation Request data containing different coefficient scenariosSetSheetItemValuesclass usageDiagram
%%{ init : { "theme" : "default" }}%% graph TB QR["Quotation Request<br/>Sheet (AN2, AQ2, G2)"] --> GSMain["quote_script.gs<br/>quote_script_main()"] GSMain --> CalcCoeff["calculateCoefficientFrom<br/>FundingSource_()"]:::major-edit GSMain --> AdjustTable["adjustFinalAnalysis<br/>TableCount_()"]:::major-edit GSMain --> ProcessTrial["processAndWriteTrialPeriod_()"]:::minor-edit CalcCoeff --> QSC["QuoteScriptConstants"]:::context AdjustTable --> QSC TestFunding["test_funding_source_logic.gs"]:::major-edit --> CalcCoeff TestFunding --> MockData["Mock Quotation<br/>Request Data"]:::context ConfigCache["ConfigCache"]:::context --> CalcCoeff ConfigCache --> AdjustTable subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes