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

fix(questionnaire): directors can update questionnaires with invalid information #601

Closed
wants to merge 10 commits into from
8 changes: 6 additions & 2 deletions app/controllers/manage/questionnaires_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ def update
@questionnaire.user.update_attributes(email: email) if email.present?
update_params = convert_school_name_to_id(update_params)
update_params = convert_boarded_bus_param(update_params, @questionnaire)
@questionnaire.update_attributes(update_params)
if HackathonConfig['brickhack_7']
JeremyRudman marked this conversation as resolved.
Show resolved Hide resolved
@questionnaire.update_with_invalid_attributes(update_params)
else
@questionnaire.update_attributes(update_params)
end
respond_with(:manage, @questionnaire)
end

Expand Down Expand Up @@ -157,7 +161,7 @@ def questionnaire_params
:portfolio_url, :vcs_url, :bus_captain_interest, :phone, :can_share_info,
:travel_not_from_school, :travel_location,
:graduation_year, :race_ethnicity, :resume, :delete_resume, :why_attend,
:bus_list_id, :is_bus_captain, :boarded_bus
:bus_list_id, :is_bus_captain, :boarded_bus, :country
)
end

Expand Down
5 changes: 5 additions & 0 deletions app/models/questionnaire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ def unaccepted_agreements
Agreement.all - agreements
end

def update_with_invalid_attributes(attributes)
assign_attributes(attributes)
save!(validate: false)
end

def as_json(options = {})
result = super
result['all_agreements_accepted'] = all_agreements_accepted?
Expand Down
2 changes: 1 addition & 1 deletion app/views/manage/questionnaires/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
= f.input :level_of_study, input_html: { "data-validate" => "presence" }
= f.input :major, input_html: { "data-validate" => "presence" }
= f.input :gender, input_html: { "data-validate" => "presence" }
= f.input :country, as: :select, collection: Questionnaire::POSSIBLE_COUNTRIES, include_blank: "(select one...)", input_html: { "data-validate" => "presence" }
= f.input :country, as: :select, collection: Questionnaire::POSSIBLE_COUNTRIES, include_blank: "(select one...)"

- if !HackathonConfig['digital_hackathon']
.card.mb-4
Expand Down
1 change: 1 addition & 0 deletions config/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ defaults: &defaults
# Logic config
accepting_questionnaires: true
digital_hackathon: false
brickhack_7: true
JeremyRudman marked this conversation as resolved.
Show resolved Hide resolved
last_day_to_apply: "<%= Date.new(2000, 1, 1).to_s %>"
event_start_date: "<%= Date.new(2000, 1, 1).to_s %>"
auto_late_waitlist: false
Expand Down