Skip to content

Flexible Grant categories #4420

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

estyxx
Copy link
Member

@estyxx estyxx commented Jun 7, 2025

  • Add flexible grant reimbursement categories
  • Add django model and migration for grant reimbursement
  • Add Django command to backfill grant reimbursements
  • Display reimbursement amounts in grants admin

What

ToDo

estyxx added 4 commits June 4, 2025 17:55
Replace the hardcoded grant reimbursement types with a configurable model. Each
conference can now define its own reimbursement categories with custom:
- Names and descriptions
- Maximum amounts per category
- Default inclusion settings
- Category types (travel, ticket, accommodation, other)

This allows for more flexible grant management where each conference can
customize their reimbursement options while maintaining data consistency
through the category system. It replaces the old hardcoded `ApprovedType`
choices with a dynamic model-based approach.
This change introduces a new GrantReimbursement model and related migration
to support flexible grant reimbursement categories. The model links grants
to their reimbursement categories and stores the granted amount for each.

Key changes:
- Add `GrantReimbursement` model as through table for M2M relationship
- Add `reimbursement_categories` M2M field to `Grant` model
- Create migration for the new model and relationship
- Add factory for testing

This change enables more granular control over grant reimbursements by
allowing different categories (e.g., travel, accommodation) with specific
amounts for each category.
Add a Django management command to migrate old grant data to the new
reimbursement model. This command will:

- Create default reimbursement categories for each conference
- Convert approved_type and amount fields into GrantReimbursement records
- Validate data integrity by comparing totals before and after migration

The migration preserves the full history of grant amounts while moving to
the new flexible category system.
Update GrantAdmin to show approved reimbursements and total allocated amount.
Add utility methods to Grant model for checking reimbursement status.

Key changes:
- Add column for approved reimbursement categories and amounts
- Add inline editor for GrantReimbursement
- Add `total_allocated_amount` and `has_approved` helper methods
- Optimize queries with select_related and prefetch_related
@estyxx estyxx self-assigned this Jun 7, 2025
Copy link

vercel bot commented Jun 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
pycon ❌ Failed (Inspect) Jun 7, 2025 8:48am

Copy link

codecov bot commented Jun 7, 2025

Codecov Report

Attention: Patch coverage is 96.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 94.49%. Comparing base (146c9bf) to head (c4631e4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4420      +/-   ##
==========================================
+ Coverage   94.47%   94.49%   +0.01%     
==========================================
  Files         351      352       +1     
  Lines       10036    10111      +75     
  Branches      710      719       +9     
==========================================
+ Hits         9482     9554      +72     
- Misses        461      463       +2     
- Partials       93       94       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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