Skip to content
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

feat: add created date to subsidy serializer #301

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion enterprise_subsidy/apps/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class Meta:
"internal_only",
"revenue_category",
"is_active",
"total_deposits"
"total_deposits",
"created",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[consider] it might also be worth exposing modified date in this serializer, too? 🤔

"modified",
# In the MVP implementation, there are only learner_credit subsidies. Uncomment after subscription
# subsidies are introduced.
# "subsidy_type",
Expand Down
6 changes: 6 additions & 0 deletions enterprise_subsidy/apps/api/v1/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ def test_get_one_subsidy(self):
"revenue_category": RevenueCategoryChoices.BULK_ENROLLMENT_PREPAY,
"is_active": True,
"total_deposits": self.subsidy_1.starting_balance,
"created": self.subsidy_1.created.strftime(SERIALIZED_DATE_PATTERN),
"modified": self.subsidy_1.modified.strftime(SERIALIZED_DATE_PATTERN),
}
self.assertEqual(expected_result, response.json())

Expand Down Expand Up @@ -275,6 +277,8 @@ def test_get_adjustments_related_subsidy(self):
"revenue_category": RevenueCategoryChoices.BULK_ENROLLMENT_PREPAY,
"is_active": True,
"total_deposits": self.subsidy_5.total_deposits,
"created": self.subsidy_5.created.strftime(SERIALIZED_DATE_PATTERN),
"modified": self.subsidy_5.modified.strftime(SERIALIZED_DATE_PATTERN),
}
total_deposits_including_positive_adjustment = sum(
[self.subsidy_5.starting_balance, APITestBase.adjustment_quantity_1]
Expand Down Expand Up @@ -313,6 +317,8 @@ def test_get_adjustments_related_subsidy(self):
"revenue_category": RevenueCategoryChoices.BULK_ENROLLMENT_PREPAY,
"is_active": True,
"total_deposits": self.subsidy_5.total_deposits,
"created": self.subsidy_5.created.strftime(SERIALIZED_DATE_PATTERN),
"modified": self.subsidy_5.modified.strftime(SERIALIZED_DATE_PATTERN),
}

total_deposits_including_negative_adjustment = sum(
Expand Down
Loading