generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LGA-3495 - Add means test answers to the reviews page (#113)
* Add means test answers to the reviews page. * Store only the category code in session * Create a new CategoryAnswer model to hold category and onward questions answers
- Loading branch information
Showing
27 changed files
with
1,390 additions
and
154 deletions.
There are no files selected for viewing
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
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,38 @@ | ||
from dataclasses import dataclass, field | ||
from enum import Enum | ||
from typing import Optional | ||
|
||
from flask import url_for | ||
from app.categories.constants import Category | ||
|
||
|
||
class QuestionType(str, Enum): | ||
SUB_CATEGORY = "sub_category" | ||
ONWARD = "onward_question" | ||
|
||
|
||
@dataclass | ||
class CategoryAnswer: | ||
question: str | ||
answer_value: str | ||
answer_label: str | ||
category: Category | ||
question_page: str | ||
next_page: str | ||
question_type: Optional[QuestionType] = field(default=QuestionType.SUB_CATEGORY) | ||
|
||
@property | ||
def edit_url(self): | ||
return url_for(self.question_page) | ||
|
||
@property | ||
def next_url(self): | ||
return url_for(self.next_page) | ||
|
||
@property | ||
def question_type_is_sub_category(self): | ||
return self.question_type == QuestionType.SUB_CATEGORY | ||
|
||
@property | ||
def question_type_is_onward(self): | ||
return self.question_type == QuestionType.ONWARD |
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
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
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
Oops, something went wrong.