-
Notifications
You must be signed in to change notification settings - Fork 4
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
[DNM] Edit multiple measures #724
Open
eadpearce
wants to merge
14
commits into
master
Choose a base branch
from
TP2000-553-edit-multiple-measures
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
130927e
Add start form and conditions
eadpearce 10a9443
Move SessionStore to common
eadpearce e03e4b6
Separate duties step, make conditions not break on first step
eadpearce 11f3031
Modify conditions form for multiple edits
eadpearce fb14b63
Add form wizard view and urls
eadpearce ad66ed2
Update templates
eadpearce 82bf1a1
Rename, edit docstrings
eadpearce f08d948
Only allow editing of end date. Remove commodities step
eadpearce d9886be
Move update measure code into separate function
eadpearce 250bed5
Split out create_conditions
eadpearce ba78703
Add test
eadpearce e22773d
Add and update tests
eadpearce 3e9faec
Remove unused method
eadpearce 6042d51
Fix merge conflicts
eadpearce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from measures import constants | ||
|
||
|
||
def show_step_end_dates(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.END_DATES in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_regulation_id(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.REGULATION_ID in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_quota_order_number(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.QUOTA_ORDER_NUMBER in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_geographical_area(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.GEOGRAPHICAL_AREA in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_duties(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.DUTIES in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_additional_code(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.ADDITIONAL_CODE in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_conditions(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.CONDITIONS in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
def show_step_footnotes(wizard): | ||
cleaned_data = wizard.get_cleaned_data_for_step(constants.START) | ||
if cleaned_data: | ||
return constants.FOOTNOTES in cleaned_data.get("fields_to_edit") | ||
|
||
|
||
measure_edit_condition_dict = { | ||
constants.END_DATES: show_step_end_dates, | ||
constants.REGULATION_ID: show_step_regulation_id, | ||
constants.QUOTA_ORDER_NUMBER: show_step_quota_order_number, | ||
constants.GEOGRAPHICAL_AREA: show_step_geographical_area, | ||
constants.DUTIES: show_step_duties, | ||
constants.ADDITIONAL_CODE: show_step_additional_code, | ||
constants.CONDITIONS: show_step_conditions, | ||
constants.FOOTNOTES: show_step_footnotes, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
START = "start" | ||
END_DATES = "end_dates" | ||
VALIDITY_DATES = "validity_dates" | ||
MEASURE_DETAILS = "measure_details" | ||
REGULATION_ID = "regulation_id" | ||
QUOTA_ORDER_NUMBER = "quota_order_number" | ||
GEOGRAPHICAL_AREA = "geographical_area" | ||
COMMODITIES = "commodities" | ||
DUTIES = "duties" | ||
ADDITIONAL_CODE = "additional_code" | ||
CONDITIONS = "conditions" | ||
FOOTNOTES = "footnotes" | ||
SUMMARY = "summary" | ||
COMPLETE = "complete" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these be refactored into one generic method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After refactoring it might be worth considering whether these belong in their own file or whether they should sit on/above a class somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree it'd be nice to be able to parametrise these with the different step names but due to how formtools is expecting them to be passed to the view (as a dictionary in urls.py) I don't think this is an easy fix. Maybe a future tech debt ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that's a bit awkward. I feel like there's a way to do it with lambdas, but might be worth creating ticket, as you say