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 652 force rule check after real edit #1130

Merged
merged 21 commits into from
Feb 8, 2024

Conversation

a-gleeson
Copy link
Contributor

TP2000-652 force rule check after real edit

Why

Successful business rule checks on a workbasket are currently valid for as long as the head transaction of the workbasket is equal to (actually less than or equal in Tamato’s code) the transaction check. As soon as a new transaction is created in a workbasket, it is ahead of the last transaction check and so becomes invalid.

However, real edits do not create new transactions, but instead update them. This could allow hidden invalid workbaskets should an edit cause a change that would otherwise cause a business rule to fail.

What

  • add TimestampedMixin to TransactionCheck
  • add TimestampedMixin to TrackedModel
  • data migration for TransactionCheck which takes the TrackedModelCheck timestamps to set TransactionCheck timestamps
  • data migration for TrackedModel which takes the Transaction timestamp to set TrackedModel timestamps
  • updated unchecked_or_errored_transactions to check that the TransactionCheck is created after the last TrackedModel in the workbasket was updated. (A real edit)
  • unit tests for a real edit
  • unit tests for data migrations

Checklist

  • Requires migrations? - Yes
  • Requires dependency updates?

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2024

Codecov Report

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

Comparison is base (5ba3162) 93.14% compared to head (a31fd56) 93.08%.

Files Patch % Lines
common/tests/test_migrations.py 22.72% 17 Missing ⚠️
checks/tests/test_migrations.py 29.41% 12 Missing ⚠️
conftest.py 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1130      +/-   ##
==========================================
- Coverage   93.14%   93.08%   -0.06%     
==========================================
  Files         575      576       +1     
  Lines       43012    43088      +76     
  Branches     3099     3100       +1     
==========================================
+ Hits        40065    40110      +45     
- Misses       2342     2371      +29     
- Partials      605      607       +2     

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

checks/tests/test_migrations.py Outdated Show resolved Hide resolved
TrackedModel = apps.get_model("common", "trackedmodel")
all_models = TrackedModel.objects.select_related("transaction").all()
paginator = Paginator(all_models, settings.DATA_MIGRATION_BATCH_SIZE)
print(f"Total: {paginator.num_pages}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could the prints be replaced by log output to allow some control over it?

Comment on lines 37 to 45
from common.models import TrackedModel

tracked_models = TrackedModel.objects.all()
for tracked_model in tracked_models:
print(tracked_model.name)

transaction_check = TransactionCheck.objects.get(
pk=tracked_model_check_1.transaction_check.transaction.pk,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hangover debug code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, debugging from this morning :)

@@ -619,15 +620,22 @@ def delete_checks(self):

@property
def unchecked_or_errored_transactions(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

It may be worth adding a docstring to this function now that logic is a bit more involved. A high-level account of how Transaction and now TrackedModel play their parts in invalidating business rule checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good shout

paginator = Paginator(all_models, settings.DATA_MIGRATION_BATCH_SIZE)
print(f"Total: {paginator.num_pages}")
for page_num in range(1, paginator.num_pages + 1):
print(f"number {page_num}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Log for print?

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'll change to a logger

@a-gleeson a-gleeson merged commit 816b866 into master Feb 8, 2024
3 checks passed
@a-gleeson a-gleeson deleted the TP2000-652--force-rule-check-after-real-edit branch February 8, 2024 13:09
dougmills-DIT pushed a commit that referenced this pull request Feb 20, 2024
* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations
dougmills-DIT added a commit that referenced this pull request Feb 23, 2024
* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* initial commit - ref doc data model

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* initial commit - ref doc data model

* wip commit

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* Formatting updates and adding end date field to footnote create (#1154)

* TP2000-1114: React enhanced forms proof of concept (#1091)

* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test

* Move babel packages out of dev deps (#1155)

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* prep for merge to mega branch

* prep for merge to mega branch

* prep for merge to mega branch

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Dale Cannon <118175145+dalecannon@users.noreply.github.com>
Co-authored-by: Tash Boyse <57753415+nboyse@users.noreply.github.com>
Co-authored-by: Matthew McKenzie <97194636+mattjamc@users.noreply.github.com>
Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>
Co-authored-by: A Gleeson <anthoni.gleeson@digital.trade.gov.uk>
Co-authored-by: Paul Pepper <85895113+paulpepper-trade@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edie Pearce <edie.pearce@digital.trade.gov.uk>
dougmills-DIT added a commit that referenced this pull request May 8, 2024
* Add reference_documents app

* WIP - Templates >:(

* Get a template of some sort working

* Add reference document detail path and templates

* add date filters to the get_context_data function

* WiP

* Rough commit - working tabs - need cleaning up

* Add button to home form

* Add comm code links to table

* initial commit - ref doc data model

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* Formatting updates and adding end date field to footnote create (#1154)

* TP2000-1114: React enhanced forms proof of concept (#1091)

* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test

* Move babel packages out of dev deps (#1155)

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* prep for merge to mega branch

* prep for merge to mega branch

* prep for merge to mega branch

* Tp2000 1186 ref doc data model (#1164)

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* initial commit - ref doc data model

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* initial commit - ref doc data model

* wip commit

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* Formatting updates and adding end date field to footnote create (#1154)

* TP2000-1114: React enhanced forms proof of concept (#1091)

* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test

* Move babel packages out of dev deps (#1155)

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* prep for merge to mega branch

* prep for merge to mega branch

* prep for merge to mega branch

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Dale Cannon <118175145+dalecannon@users.noreply.github.com>
Co-authored-by: Tash Boyse <57753415+nboyse@users.noreply.github.com>
Co-authored-by: Matthew McKenzie <97194636+mattjamc@users.noreply.github.com>
Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>
Co-authored-by: A Gleeson <anthoni.gleeson@digital.trade.gov.uk>
Co-authored-by: Paul Pepper <85895113+paulpepper-trade@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edie Pearce <edie.pearce@digital.trade.gov.uk>

* prep for merge to mega branch

* Add command to import duties and quotas

* Add command to import duties and quotas

* Functionality to edit reference documents

* CRUD templates

* Reference Doc CRUD

* Add factories, add editing for rates - still WIP but working

* Add factories, add editing for rates - still WIP but working

* Add factories, add editing for rates - still WIP but working

* TP2000-1232 Reference doc UI management (#1165)

* Functionality to edit reference documents

* CRUD templates

* Reference Doc CRUD

* fixed time zone issue with factories.py

* Create update form tests

* fixed time zone issue with factories.py

* add basic tests for models

* add basic tests for models

* Add test init files

* View and form tests for ref doc crud

* Remove init files

* Add reference doc form and view tests

* Move get_area_name_by_id to model

* add basic tests for models

* add basic tests for models

* add basic tests for models

* update edit quota view

* fix views

* Ref doc versions create and edit urls/templates

* Ref doc formatting tidy up

* Ref doc versions create and edit views/form

* fix views

* fix views

* Update ref doc create breadcrumbs

* Ref doc version delete

* Delete ref doc version and confirmation pages

* Area ID and version form validation

* update data

* Ref doc versions form and view tests

* Add model test for get_area_name_by_id

* Update data model

* Preferential rate style and consistency tidy

* separate out the context from reference document version details

* separate out the context from reference document version details

* separate out the context from reference document version details

* separate out the context from reference document version details

* separate out the context from reference document version details

* Pref quota bulk create base

* add / edit order number

* Bulk add preferential quotas for a commodity code list

* add / edit order number

* Bulk create quotas for multiple validity period volume combos

* WIP commit - quota and order number updates

* WIP commit - quota and order number updates

* quota and order number views + test fixes

* quota and order number views + test fixes

* Bulk create quotas redo without validityperiodform

* test fixes

* Add js remove button to additional quota definition forms

* tested quota order number and quota forms

* Preferential quota bulk create tests

* Content standardisations

* Add preferential quota bulk create for specific order numbers

* models 100% tested, forms 100% tested

* models 100% tested, forms 100% tested

* Ref doc and versions view tests

* added more tests

* added more tests

* tidy up for PR

* tidy up for PR

* Stop add new button submitting form when js is disabled

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* content corrections

* content corrections

* fixes for breadcrumbs

* fixes for breadcrumbs

* minor fix

* minor text changes

* updates to ref doc data import management command

* Test fixes after content change

* Updates from Dale's review

* updated based on PR comments

* updated based on PR comments

* updated js based on linting issues

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Lauren Qurashi <lauren.qurashi@digital.trade.gov.uk>
Co-authored-by: Anthoni Gleeson <anthoni.gleeson@digital.trade.gov.uk>
Co-authored-by: Dale Cannon <118175145+dalecannon@users.noreply.github.com>
Co-authored-by: Tash Boyse <57753415+nboyse@users.noreply.github.com>
Co-authored-by: Matthew McKenzie <97194636+mattjamc@users.noreply.github.com>
Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>
Co-authored-by: Paul Pepper <85895113+paulpepper-trade@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edie Pearce <edie.pearce@digital.trade.gov.uk>
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