-
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.
- make cookie expiration 2 days - consistent backlinks helper used in layouts - GovOne docs and Yard updates - remove duplication and leftovers in controllers and routes - update locales - add spec around re-caching on timeout - change interruption page layout - Convert error pages to CMS resources - Remove early_years_emails code - Lint / fix / drop field - Brakeman security issues for response/feedback strong params - yarn upgrade - npm package upgrade - retry after CMS error - refactor answering logic into concern - widen interruption page - clean layouts into partials - Use column names as headers for feedback data exports - Remove public beta redirect
- Loading branch information
1 parent
f552dbf
commit eb5b739
Showing
94 changed files
with
2,033 additions
and
2,107 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 was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,45 @@ | ||
# Form processing for training and feedback | ||
# | ||
module Answering | ||
extend ActiveSupport::Concern | ||
|
||
private | ||
|
||
# @return [Boolean] | ||
def multiple_choice? | ||
params[:response][:answers].is_a?(Array) | ||
end | ||
|
||
# @return [Boolean] | ||
def correct? | ||
content.opinion_question? ? true : content.correct_answers.eql?(response_answers) | ||
end | ||
|
||
# @return [ActionController::Parameters] | ||
def response_params | ||
if multiple_choice? | ||
params.require(:response).permit(:text_input, answers: []) | ||
else | ||
params.require(:response).permit(:text_input, :answers) | ||
end | ||
end | ||
|
||
# @return [String] | ||
def response_text_input | ||
response_params[:text_input] | ||
end | ||
|
||
# @return [Array<Integer>] | ||
def response_answers | ||
Array(response_params[:answers]).compact_blank.map(&:to_i) | ||
end | ||
|
||
# @return [Boolean] | ||
def save_response! | ||
current_user_response.update( | ||
answers: response_answers, | ||
correct: correct?, | ||
text_input: response_text_input, | ||
) | ||
end | ||
end |
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
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
32 changes: 0 additions & 32 deletions
32
app/controllers/registration/early_years_emails_controller.rb
This file was deleted.
Oops, something went wrong.
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
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.