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

fix: remove unapplicable conditional unique constraint on subsidy #167

Merged
merged 1 commit into from
Oct 31, 2023
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
5 changes: 4 additions & 1 deletion enterprise_subsidy/apps/api/v1/views/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ def base_queryset(self):
for learner_only_context in learner_only_contexts:
# For each context (enterprise_customer_uuid) that the requester only has learner access to, filter
# transactions related to that context to only include their own transactions.
# pylint: disable=unsupported-binary-operation
# AED 2023-10-31: locally, pylint complains of the binary operation.
# In github actions, pylint complains of a useless-suppression.
# Suppressing both and letting the code gods sort it out.
# pylint: disable=unsupported-binary-operation,useless-suppression
if request_jwt.get('user_id'):
queryset = queryset.filter(
(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.19 on 2023-10-31 13:02

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('subsidy', '0018_alter_historicalsubsidy_options'),
]

operations = [
migrations.AlterModelOptions(
name='historicalsubsidy',
options={'get_latest_by': 'history_date', 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical subsidy'},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.19 on 2023-10-31 13:04

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('subsidy', '0019_alter_historicalsubsidy_options'),
]

operations = [
migrations.RemoveConstraint(
model_name='subsidy',
name='unique_reference_id_non_internal',
),
]
8 changes: 0 additions & 8 deletions enterprise_subsidy/apps/subsidy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from uuid import uuid4

from django.db import models
from django.db.models import Q
from django.utils.functional import cached_property
from edx_rbac.models import UserRole, UserRoleAssignment
from edx_rbac.utils import ALL_ACCESS_CONTEXT
Expand Down Expand Up @@ -104,13 +103,6 @@ class Meta:
"""
Metaclass for Subsidy.
"""
constraints = [
models.UniqueConstraint(
condition=Q(internal_only=False), # Allow more flexibility for internal/test subsidies.
fields=["reference_id", "reference_type"],
name="unique_reference_id_non_internal",
)
]
ordering = ['-created']

# Please reserve the "subsidy_type" field name for the future when we use it to distinguish between
Expand Down
Loading