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

TP2000-1083: Quota order number create #1081

Merged
merged 11 commits into from
Nov 14, 2023

Conversation

eadpearce
Copy link
Contributor

@eadpearce eadpearce commented Oct 31, 2023

TP2000-1083: Quota order number create

What

  • Adds a link to the create quota form from the workbasket page and the quota search page
  • Adds the quota create form and confirmation page
  • Confirmation page links to the quota origin create form
Create quota confirmation page Create quota form validation errors Create quota form

@eadpearce eadpearce force-pushed the TP2000-1083-quota-order-number-create branch from 2076aa1 to f78fc6a Compare October 31, 2023 15:12
quotas/forms.py Outdated
Comment on lines 246 to 247
def set_initial_data(self, *args, **kwargs):
self.fields["category"].initial = self.instance.category
Copy link
Contributor

Choose a reason for hiding this comment

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

Would self.instance always be None in the case of this create form?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah not sure why this didn't blow up. It can be removed

Comment on lines +47 to +56
path(
f"quotas/create/",
views.QuotaCreate.as_view(),
name="quota-ui-create",
),
path(
f"quotas/<sid>/confirm-create/",
views.QuotaConfirmCreate.as_view(),
name="quota-ui-confirm-create",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think get_ui_paths() can automatically generate these routes so long as the corresponding views exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've been avoiding using that because it obscures how the urls are defined. I'd much rather have them declared explicitly.

])
}}
{{ workbasket_column("Regulations", [
{"text": "Create new regulation", "url": url('regulation-ui-create')},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{"text": "Create new regulation", "url": url('regulation-ui-create')},
{"text": "Create a new regulation", "url": url('regulation-ui-create')},

to match the other links?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I didn't notice this. Yeah I had just copy pasted and changed the model name. This probably reads better

@@ -105,6 +105,20 @@ def get_queryset(self):
return models.QuotaOrderNumber.objects.approved_up_to_transaction(tx)


class QuotaCreate(QuotaOrderNumberMixin, CreateTaricCreateView):
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth adding validation for business rules ON1 and ON2?

@eadpearce eadpearce force-pushed the TP2000-1083-quota-order-number-create branch from bf37bb5 to 02a60f8 Compare November 14, 2023 12:15
@codecov-commenter
Copy link

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (798ae96) 92.80% compared to head (02a60f8) 92.79%.
Report is 3 commits behind head on master.

Files Patch % Lines
workbaskets/views/ui.py 82.19% 8 Missing and 5 partials ⚠️
importer/views.py 80.95% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1081      +/-   ##
==========================================
- Coverage   92.80%   92.79%   -0.01%     
==========================================
  Files         460      460              
  Lines       34941    35083     +142     
  Branches     2674     2692      +18     
==========================================
+ Hits        32426    32557     +131     
- Misses       1992     1995       +3     
- Partials      523      531       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eadpearce eadpearce merged commit 7714a0b into master Nov 14, 2023
3 checks passed
@eadpearce eadpearce deleted the TP2000-1083-quota-order-number-create branch November 14, 2023 13:53
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.

3 participants