Skip to content

🧹 [Code Health] Extract duplicate markdown logic into format_grade_report - #39

Merged
calmcoconut merged 1 commit into
mainfrom
fix-duplicate-markdown-formatting-6058831112794365781
Jul 3, 2026
Merged

calmcoconut merged 1 commit into
mainfrom
fix-duplicate-markdown-formatting-6058831112794365781

Conversation

@calmcoconut

Copy link
Copy Markdown
Owner

🎯 What: Extracted duplicate markdown string building logic in grade_responses.py into a new helper function format_grade_report and added unit testing for it.

💡 Why: Lines 710-721 and 770-780 contained identical logic for building the question grading markdown format. Extracting this reduces duplication, makes future formatting modifications easier and centralized, and ensures consistency between regular chapter grades and cumulative exam grades.

✅ Verification: Verified by running the relevant test suite python -m pytest tests/test_grade_responses.py which passes successfully, ensuring the generated markdown matches previous behavior exactly.

✨ Result: Improved codebase readability and maintainability without altering existing functionality.


PR created automatically by Jules for task 6058831112794365781 started by @calmcoconut

- Extracted duplicated logic around lines 710 and 770 in `grade_responses.py` into a helper function `format_grade_report`.
- Updated loops in `grade_responses.py` to call `format_grade_report` instead of relying on duplicate logic.
- Added a unit test in `tests/test_grade_responses.py` to verify the output of `format_grade_report` matches expectations.

Co-authored-by: calmcoconut <41926305+calmcoconut@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@calmcoconut
calmcoconut merged commit e0a8f62 into main Jul 3, 2026
1 check passed
@calmcoconut
calmcoconut deleted the fix-duplicate-markdown-formatting-6058831112794365781 branch July 3, 2026 07:40
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.

1 participant