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

Comments and simplifications. #531

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stuaxo
Copy link
Contributor

@stuaxo stuaxo commented Apr 7, 2022

These are extra comments + simplifications found looking at TP2000-169, but that weren't actually part of that PR.

Currently encompasses comments for signposting (bits where I was wondering "what does this do and why") along possibly more controversial changes (stopping form_valid call form_invalid, which feels like an API violation).

Comment on lines 834 to +842
def condition_string(self) -> str:
out: list[str] = []
"""
Returns a string representation of the component conditions.

components = self.components.latest_approved()
This is the duty_sentence, if there is one measure, measure_type and additional_code or
if there are more than one measure_type and additional_code.

:dependencies: with_duty_sentence must be called in queries using this property.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this method even used anywhere? I've never really understood what it is meant to be showing?


components = self.components.latest_approved()
Copy link
Contributor

Choose a reason for hiding this comment

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

current() would be better, to take account of any draft data.

if form.is_valid() and not self.form_violates(form):
return self.form_valid(form)
else:
return self.form_invalid(form)
Copy link
Contributor

Choose a reason for hiding this comment

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

So instead of overriding form_valid (which also calls form_invalid) on TrackedModelChangeView should we instead override the post call do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably - at the moment I was getting a load of test failures with this change, I need to get past.

Though, this may be another issue as since I re-setup my env again, I noticed I am getting them in plain master now :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants