Skip to content

PPHA-589: multiple types of smoking history#317

Merged
jamiefalcus merged 16 commits intomainfrom
PPHA-589-multiple-types-of-smoking-history
Mar 5, 2026
Merged

PPHA-589: multiple types of smoking history#317
jamiefalcus merged 16 commits intomainfrom
PPHA-589-multiple-types-of-smoking-history

Conversation

@Themitchell
Copy link
Contributor

What is the change?

Why are we making this change?

@Themitchell Themitchell changed the title Ppha 589 multiple types of smoking history PPHA-589: multiple types of smoking history Mar 2, 2026
@Themitchell Themitchell force-pushed the PPHA-589-multiple-types-of-smoking-history branch 2 times, most recently from f13067e to 0d0431e Compare March 3, 2026 12:23
@Themitchell Themitchell marked this pull request as ready for review March 4, 2026 15:59
@jamiefalcus jamiefalcus force-pushed the PPHA-589-multiple-types-of-smoking-history branch from 59b3b06 to d6c8c71 Compare March 4, 2026 16:01
@jamiefalcus jamiefalcus requested a review from Copilot March 4, 2026 16:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the smoking-history flow to support multiple tobacco types per response set (including new cigar size variants and rolling tobacco), and standardizes how tobacco types are represented in URLs and user-facing strings.

Changes:

  • Introduces url_type() / by_url_type() routing for tobacco types and updates views to use it.
  • Expands tobacco-type handling (e.g., rolling tobacco, pipe, cigar size variants) and updates presenters/templates to use get_type_display()/unit().
  • Updates unit tests + Behave features to cover multi-type smoking history journeys.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
lung_cancer_screening/questions/views/types_tobacco_smoking.py Redirect uses the first tobacco history item’s url_type() instead of inflection.
lung_cancer_screening/questions/views/smoking_history_question_base_view.py Normal-history lookup updated to use by_url_type(...).normal().
lung_cancer_screening/questions/views/smoking_frequency.py Passes normal-history item for changed levels via form kwargs.
lung_cancer_screening/questions/views/smoking_current.py Passes the current tobacco history item into SmokingCurrentForm.
lung_cancer_screening/questions/views/smoking_change.py Scopes change flow to the selected tobacco type via by_url_type().
lung_cancer_screening/questions/views/smoked_total_years.py Adds logic to progress to the next unanswered tobacco type after completion.
lung_cancer_screening/questions/views/responses.py Back-link now uses TobaccoSmokingHistory.url_type().
lung_cancer_screening/questions/views/mixins/ensure_smoking_history_for_type.py Looks up history items via by_url_type() instead of camelizing the URL param.
lung_cancer_screening/questions/tests/unit/views/test_types_tobacco_smoking.py Updates redirect expectation to use slugify(...).
lung_cancer_screening/questions/tests/unit/views/test_smoking_frequency.py Factory usage updated to new traits (e.g., cigarettes=True).
lung_cancer_screening/questions/tests/unit/views/test_smoking_current.py Updates factories and redirects to use url_type().
lung_cancer_screening/questions/tests/unit/views/test_smoking_change.py Adds regression coverage for multiple types when selecting change levels.
lung_cancer_screening/questions/tests/unit/views/test_smoked_total_years.py Adds coverage for moving to the next tobacco type after increased/decreased flows.
lung_cancer_screening/questions/tests/unit/views/test_smoked_amount.py Updates factories and removes a WIP tag.
lung_cancer_screening/questions/tests/unit/presenters/test_tobacco_smoking_history_presenter.py Updates expected presenter strings for rolling tobacco naming/units.
lung_cancer_screening/questions/tests/unit/presenters/test_response_set_presenter.py Updates types list expectations to new/renamed tobacco types.
lung_cancer_screening/questions/tests/unit/models/test_tobacco_smoking_history.py Adds tests for url_type, by_url_type, unit, and per-type query helpers.
lung_cancer_screening/questions/tests/unit/models/test_smoked_amount_response.py Updates factory usage to cigarettes=True.
lung_cancer_screening/questions/tests/unit/models/test_response_set.py Adds test for distinct ordered tobacco types list.
lung_cancer_screening/questions/tests/unit/forms/test_types_tobacco_smoking_form.py Updates factory usage to new traits.
lung_cancer_screening/questions/tests/unit/forms/test_smoking_frequency_form.py Updates form signature usage (no response_set; adds normal-history param).
lung_cancer_screening/questions/tests/unit/forms/test_smoking_current_form.py Verifies label/error messages are type-specific via passed history item.
lung_cancer_screening/questions/tests/unit/forms/test_smoking_change_form.py Updates factories + adds test asserting label contains tobacco type.
lung_cancer_screening/questions/tests/unit/forms/test_smoked_total_years_form.py Adds required error message test including tobacco unit/type.
lung_cancer_screening/questions/tests/unit/forms/test_smoked_amount_form.py Updates expectations for medium cigars and new unit-aware labels/messages.
lung_cancer_screening/questions/tests/factories/tobacco_smoking_history_factory.py Replaces/extends traits to include cigar sizes + rolling tobacco.
lung_cancer_screening/questions/presenters/tobacco_smoking_history_type_presenter.py Uses get_type_display() for titles and summary labels.
lung_cancer_screening/questions/presenters/tobacco_smoking_history_presenter.py Delegates URL/type display to model and uses unit() in sentences.
lung_cancer_screening/questions/presenters/response_set_presenter.py Uses get_type_display() when listing tobacco types smoked.
lung_cancer_screening/questions/models/tobacco_smoking_history.py Adds unit(), url_type(), by_url_type(), and expands tobacco type choices.
lung_cancer_screening/questions/models/response_set.py Adds types_tobacco_smoking_history() helper for distinct ordered type list.
lung_cancer_screening/questions/migrations/0004_alter_tobaccosmokinghistory_level_and_more.py Data migration for rolled→rolling and alters tobacco/history fields.
lung_cancer_screening/questions/jinja2/smoked_amount.jinja Uses get_type_display() and unit() for headings/wording.
lung_cancer_screening/questions/jinja2/have_you_ever_smoked.jinja Updates example copy (rolled → rolling tobacco).
lung_cancer_screening/questions/forms/smoking_frequency_form.py Removes response_set dependency; uses passed normal-history item.
lung_cancer_screening/questions/forms/smoking_current_form.py Label + required message now derived from injected tobacco history item.
lung_cancer_screening/questions/forms/smoking_change_form.py Updates label/messages to use unit-aware strings; fixes existing-level scoping.
lung_cancer_screening/questions/forms/smoked_total_years_form.py Unit-aware labels and required error message.
lung_cancer_screening/questions/forms/smoked_amount_form.py Unit/suffix updates, especially for rolling tobacco and pipe.
features/types_tobacco_smoking.feature Updates expected UI strings and adds a screenshot step.
features/steps/page_assertion_steps.py Adds a step to assert the page title text.
features/steps/debug_steps.py Adds debug step(s) to print smoking history.
features/smoking_history.feature Adds an end-to-end scenario covering multiple tobacco histories.
.vscode/settings.json Adds “kwargs” to spellchecker words and adjusts JSON formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Themitchell Themitchell force-pushed the PPHA-589-multiple-types-of-smoking-history branch from 45db521 to 27dee73 Compare March 5, 2026 11:50
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@jamiefalcus jamiefalcus merged commit 022db13 into main Mar 5, 2026
25 checks passed
@jamiefalcus jamiefalcus deleted the PPHA-589-multiple-types-of-smoking-history branch March 5, 2026 13:27
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