Browse Source

added aboutthislog test json

pull/78/head
magicmilo 3 years ago
parent
commit
f14597bbbc
  1. 2
      app/helpers/check_answers_helper.rb
  2. 5
      config/forms/2021_2022.json
  3. 0
      db/migrate/20211102100820_add_about_this_log_readable_columns
  4. 13
      db/schema.rb
  5. 181
      spec/fixtures/forms/test_aboutthislog.json

2
app/helpers/check_answers_helper.rb

@ -58,6 +58,8 @@ module CheckAnswersHelper
case_log[question_key].blank? || !case_log[question_key].send(operator, operand)
when "radio"
case_log[question_key].blank? || !condition.include?(case_log[question_key])
when "select"
case_log[question_key].blank? || !condition.include?(case_log[question_key])
else
raise "Not implemented yet"
end

5
config/forms/2021_2022.json

@ -33,9 +33,6 @@
"header": "You cannot use this service",
"hint_text": "",
"description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.",
"questions": {
},
"default_next_page" : "check_answers"
},
"organisation_details": {
@ -82,7 +79,7 @@
"sale_completion_date": { "sale_or_letting": "Sale" },
"tenant_same_property_renewal": { "sale_or_letting": "Letting" }
},
"default_next_page" : "check_answers"
"default_next_page" : ["check_answers"]
}
},
"tenant_same_property_renewal": {

0
db/migrate/20211102100820_add_about_this_log_readable_columns.rb → db/migrate/20211102100820_add_about_this_log_readable_columns

13
db/schema.rb

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_11_02_100820) do
ActiveRecord::Schema.define(version: 2021_10_27_123535) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -133,17 +133,6 @@ ActiveRecord::Schema.define(version: 2021_11_02_100820) do
t.boolean "reasonable_preference_reason_do_not_know"
t.datetime "discarded_at"
t.string "other_tenancy_type"
t.string "gdpr_acceptance"
t.string "gdpr_declined"
t.string "property_owner_organisation"
t.string "property_manager_organisation"
t.string "sale_or_letting"
t.string "tenant_same_property_renewal"
t.string "rent_type"
t.string "intermediate_rent_product_name"
t.string "needs_type"
t.string "sale_completion_date"
t.string "purchaser_code"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
end

181
spec/fixtures/forms/test_aboutthislog.json vendored

@ -0,0 +1,181 @@
{
"form_type": "lettings",
"sections": {
"about_this_log": {
"label": "About this log",
"subsections": {
"about_this_log": {
"label": "About this log",
"pages": {
"gdpr_acceptance": {
"header": "DLUHC Privacy Notice Acceptance",
"description": "",
"questions": {
"gdpr_acceptance": {
"check_answer_label": "GDPR acceptance",
"header": "Has the tenant or buyer seen the DLUHC privacy notice?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Yes",
"1": "No"
}
}
},
"conditional_route_to": {
"organisation_details": { "gdpr_acceptance": "Yes" }
},
"default_next_page": "gdpr_declined"
},
"gdpr_declined": {
"header": "You cannot use this service",
"hint_text": "",
"description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.",
"questions": {
},
"default_next_page" : "check_answers"
},
"organisation_details": {
"header": "About this log",
"description": "Organisation Details",
"questions": {
"property_owner_organisation": {
"check_answer_label": "",
"header": "Which organisation owns this property?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "A",
"1": "B"
}
},
"property_manager_organisation": {
"check_answer_label": "",
"header": "Which organisation manages this property?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "A",
"1": "B"
}
}
}
},
"sale_or_letting": {
"header": "About this log",
"description": "Is this a sale or a letting?",
"questions": {
"sale_or_letting": {
"check_answer_label": "",
"header": "Is this a sale or a letting?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Sale",
"1": "Letting"
}
},
"conditional_route_to": {
"sale_completion_date": { "sale_or_letting": "Sale" },
"tenant_same_property_renewal": { "sale_or_letting": "Letting" }
},
"default_next_page" : ["check_answers"]
}
},
"tenant_same_property_renewal": {
"header": "About this log",
"description": "Is this a renewal to the same tenant in the same property?",
"questions": {
"tenant_same_property_renewal": {
"check_answer_label": "",
"header": "Is this a renewal to the same tenant in the same property?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Yes",
"1": "No"
}
}
}
},
"tenancy_start_date": {
"header": "About this log",
"description": "",
"questions": {
"tenancy_start_date": {
"check_answer_label": "When is the tenancy start date?",
"header": "What is the tenancy start date?",
"hint_text": "For example, 27 3 2007",
"type": "date"
}
}
},
"letting_type": {
"header": "About this log",
"description": "",
"questions": {
"rent_type": {
"check_answer_label": "What is the rent type?",
"header": "What is the rent type?",
"hint_text": "",
"type": "select",
"answer_options": {
"0": "Social Rent",
"1": "Affordable Rent",
"2": "London Affordable Rent",
"3": "Rent To Buy",
"4": "London Living Rent",
"5": "Other Intermediate Rent Product"
}
},
"intermediate_rent_product_name": {
"check_answer_label": "Enter the product name",
"header": "What is intermediate rent product name?",
"type": "text",
"conditional_for": {
"rent_type": ["Other Intermediate Rent Product"]
}
},
"needs_type": {
"check_answer_label": "What is the needs type?",
"header": "What is the needs type?",
"hint_text": "",
"type": "select",
"answer_options": {
"0": "Supported Housing",
"1": "General Needs"
}
}
}
},
"sale_completion_date": {
"header": "About this log",
"description": "",
"questions": {
"sale_completion_date": {
"check_answer_label": "What is the sale completion date?",
"header": "What is the sale completion date?",
"hint_text": "For example, 27 3 2007",
"type": "date"
}
}
},
"purchaser_code": {
"header": "About this log",
"description": "",
"questions": {
"purchaser_code": {
"check_answer_label": "What is the purchaser code?",
"header": "What is the purchaser code?",
"hint_text": "",
"type": "text"
}
}
}
}
}
}
}
}
}
Loading…
Cancel
Save