quby 4.0.4 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +0 -1
- data/lib/quby.rb +2 -10
- data/lib/quby/answers/entities/answer.rb +4 -2
- data/lib/quby/answers/services/score_calculator.rb +1 -3
- data/lib/quby/engine.rb +0 -1
- data/lib/quby/questionnaires.rb +1 -0
- data/lib/quby/questionnaires/api.rb +5 -1
- data/lib/quby/questionnaires/deserializer.rb +441 -0
- data/lib/quby/questionnaires/dsl.rb +12 -15
- data/lib/quby/questionnaires/entities.rb +1 -0
- data/lib/quby/questionnaires/entities/charting/line_chart.rb +23 -0
- data/lib/quby/questionnaires/entities/charting/overview_chart.rb +3 -1
- data/lib/quby/questionnaires/entities/definition.rb +3 -5
- data/lib/quby/questionnaires/entities/fields.rb +0 -15
- data/lib/quby/questionnaires/entities/question.rb +9 -32
- data/lib/quby/questionnaires/entities/questionnaire.rb +4 -15
- data/lib/quby/questionnaires/entities/questions/checkbox_question.rb +0 -24
- data/lib/quby/questionnaires/entities/questions/date_question.rb +0 -8
- data/lib/quby/questionnaires/entities/score_calculation.rb +40 -3
- data/lib/quby/questionnaires/repos.rb +1 -0
- data/lib/quby/questionnaires/repos/bundle_disk_repo.rb +51 -0
- data/lib/quby/table_backend/range_tree.rb +0 -51
- data/lib/quby/version.rb +1 -1
- data/spec/features/tables_spec.rb +40 -0
- data/spec/fixtures/score_test.rb +4 -0
- data/spec/internal/log/test-events.log +183 -0
- data/spec/internal/log/test.log +5522 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/00/00nglkSepN01iGiDa7URmJtWQP-xSWffZb9wJgBqUr4.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/1V/1VQnRlqKBL0MybpMmC3EVtA2s6-ZX-GSGs2Cza3g3kI.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/1_/1_J_3havMjJDCz3iAQXAXXBh6tBQRJ3OpdWm3W46ss8.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/4G/4gcYvPHmPX3fZw9xr6plMl5Hfbo2xTWwcD7T7lIlD4Y.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/4_/4_FK6PMcF1eyIQx7RtVQ5t8c6X7smPQmJWNN5YTImVc.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/4d/4Dd15Upcg8_kiEsx_5wpQNrjM1sCk0tGTtWGhtmCKpg.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/4h/4hd8RzwlWb2IEeLLZN0s-3_sdJXtw6nu2k5baLb9vNs.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/5X/5xFJleOz2sGyE9gbs8KPkToDiv3s9bwFzroBRcjPELY.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/6Y/6y1tV_fKJP9YIQn-dF847aZ9kza1O7iyTEUht42D7nc.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/6d/6dfYZY_DkQe892FZVDUbBbrINslzVUkLZePdnVxO3Ps.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/6w/6WcYsWQCgw0z_URAWGhOsbiKXcqVxZ--ImazY5S-2Gk.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/77/77EJjFGVCRzLbhJy6KZZUYe5w0LxsqZQcmFcHAbxKeQ.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/7f/7fvhJnfiJknq6sA-MPtumXlL5qB-rfH__Heye13NyHc.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/8W/8W6AwDwFqo6egmWyt6Cs0vf_XJbT2YxPs2sqbo0Q9kk.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/8c/8cQ8uBhUhrouKwor0Z87dDCxyPbqbLvK8KEFEgjHxqM.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/9L/9LJo1U9wQdfWrrn3HkNZTgIZc6jeHvWbGk8tJ4m_Qec.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/9o/9oXJXZnA6F49i4EflydD0Ivx6dhSxGGDD69G-N5NSCg.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/A1/a1jgtYtDHIb04Og07H6_XNmhXppaAnFiO88kgq80edQ.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/AC/ACV6t4unw39Kpn2DnbBtHeJYLoAHyyBN1DTRXs6a2ik.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/BO/BoVO8e1GTTGHfnJTOByDxMlvVi9fNGyOdSubqCbBITI.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Ba/babjk3aW-jBoEw_ERhmT5ZQprEqilJCWmImrvVskWk8.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Cg/cgb1vvOogMD0V1lqQ5k_mny7Z38rbqBdIumlGh5sZ_E.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Cw/CwjNk_RYiC93RW8vRs7fWsHcwKTg7uE9OLifRm3Y6WA.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/DY/Dy1qsY0W-eyFR6RVKSCCli-XsitpaXD4DwTjXL86t2M.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Dk/DkGOwkJNeDdljv4b8QbwtPVrsghwYuA6EOxx1goEQg0.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/FG/fGmVSU-v7aZV9-CLG5U2OmteGgWTuAotlFcwFyx4Eqs.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Fd/fDidWZjSZsPN4uAEyVYABV2WFCSR7AZE0l8U-9XOw7U.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/G1/G1RRwpldS5MGQ5x-WHyPWzXJWDOd2qyWMMFumuU4-Ms.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/GG/ggGfy_gZryUPmYwgenN3A4jv0q-buxyjCGdLB6wfHxQ.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/GY/gYwYoJrifknCG-a0FXlM1NU6tUj1JXxm27s-a0uP_IE.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/I6/i64Ysik0cyoTrYF0-O63B7sN3AdIgeoJ7zLh9pMC2u4.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Ic/ICKeOd4yOff3JGsfU1XliLgXfJtTPKSbXsqNVZAb1-Y.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/J7/J75M1l--IMcCn-Wy7uWv17SWaj0DFaGiiwac63pENPQ.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Jh/JHPqsKZsrkvQg23ukphinYoViiIw3askwCMP8VrHTMk.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/K9/k9tOCRdX5tsxa5LImq7MZk0WzC692t8tx5LzLln0l4Q.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/LY/ly4TNAIbW9ghgXz8mxfmskR_6AkuiMiG-RIFGhewgQ0.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Lq/LQ9fP0wIqVc5s-AtP3ESWJr0qpkDe-VpTxpgYl-9FfU.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/MO/MOmnpcaRW98Ke-zTOOCSZ0ODnnQntKhQr0vFc_un1_A.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/OX/OxOBsUA5EpScoZgEt_UhsHzhu-GGmxKnHpCwnhbTwiM.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Ot/oTVAc3-iuSlg7XAM-YIAhw3cdc5yhgL2-tK3N7sfOfU.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/PK/pKNcBOgAbCyIwsWIvnlmiPiFxrw6nUo_nTz7wWFDr80.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/QB/QBMvSW7SYbYcm5lSjybgO7fhHDFIQjJWOvefH0MQC-A.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Qs/QSbtm1y8JKPV0MQkpiC0hEisaSjKZ3tp2AWHSrhO30Y.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Sp/SpyGDguFy3tp0sim1miZOehEDpE97oueO7wl3oUFYcE.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/TW/TwtJPRSE9lmwTuSP0lezWSRSBp2u43zuF196FQcHY-c.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/VX/Vxn9zv60MCKUBfRhrjefo-MEzFej81PPEutxTPQ4VLQ.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/Vr/vrqPEzlsuORocHY0EbtGdFomRmrcoAa6wWSDMx642-Q.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/WH/WHVQ0GBe51hbYqv2g7YYo7EIw9PSzt9-RqU7hKP2dc4.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/_B/_B796ezRHfk7H8YKj7zr3-gRy6Mw2IVn2NbHu-k20ug.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/_W/_Wh-7b1t-Xm19wg3KPtkXq7DOpohaL5OhnLggzJLpj4.cache +0 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/b2/B2y-2qTbQYKRm6_sCQ6qfUeVfl9rKXUvotTDm56w4bs.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/bw/bwFR2MLpvJvPSAPJzSLWk6TUDCw5TlBFUUuq7z_Y9vg.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/c7/c7ubvrHhbhAYh-K4srvM9EqwWdbWTLrsLMgjG5XQDbY.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/cX/CXpMzZYfJy6HIOVXN0IyYilvy6J4CDgFZIwqKm8OQEU.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/eN/EN0enu5dkKEnIz-DVCpbhkfeph7wImeXnlqb7SXMrjE.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/fu/fuP9zP6C6rj650HLkypoTfYN2KD1ecB9HdtlbhbA2cg.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/gr/gRPXI3EsVPwysy9YKW_6yDxaqRRr4Idxtexf7zCHECw.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/h0/h0P63ZZdlSbtztDOe0V9r7jtCoy0L2bAf_iDNKLJ0nk.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/i-/i-Or0Xuxbbm3-HdE_xGIf6sAx2vhUa3eVMpbT37lyEo.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/iF/iFP67If98izMEAAMKnAFi2dWAb8TNlHNayZKNjXdAMs.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/iH/Ih2svq5ul-xibfRUfd1fxigouli6U19Rf80FrTSoMak.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/ka/Ka_YEbZNQxpS8XAA7xZturgPr2vLYQq60KK1uwou4Lo.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/kq/KqkIGfAdJjTcr53lFl1aDAMUeqhhKdXGyTlHVlCz0R4.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/mR/mRDPkwomGSfjpIWEKtPPBSx5cBHssvH8v0gCSI33P3Y.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/n4/n4qaNjjNvKB0VAbVJlP_BjFlcLf70TsBzcIMc7VO9dw.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/nY/nykt5oy2ExUYa8g1phLCDRqwb55BuUot5ZBbRdNuCCw.cache +2 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/nv/nvmgm4bOtxCbD6EA14ZIwDcYO8fxXOoEk_s7V-uRMMM.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/oG/og5ypFjbFAX_nH7oxK6Bn5Ejh81BMDBSMxbGcL5ZbQs.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/oO/oO4iBwOm5E7uLH39zeR8zun4eBM-WxZKvEMpIYKx6SU.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/pN/PnQ-dEclV6jTDE4kkqw4G9dBpHArAgUnATOpRrQAsGc.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/pe/pet4fFbc2Cm2SD_ZBO_s83Gey29EXE26u-7lwn2O8gM.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/qo/Qoqb-JjTe1BiY4rICKHm5e6bsPt-DHXZc4ADXESjw2I.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/qx/QXICLj9xx1EI9rBeXLXpKOeHGll_LBWHRWlpb1DK424.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/rM/rMF4Y2UGkmBABLlC1eSSqb6y6g_Z3uUCLBtFvz_LoyI.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/ty/ty1qAnpL07anYdhIJoiPYLcsWKejuzy6JaxU9mI7egw.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/uH/UHs9nE45XS7v4QlMjSjhwHbqYIKC06FsEjMSMIfKanU.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/v8/v8VXJ3AQom-JqxBYAB7tOjV-tt4IdDb6YyFEzlsWV8c.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/vD/VDI2CxkTg7-DuMcLmofLvch0yukSl88oI_AjGgN-hQ8.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/wq/wqhk46aZc1Bbb8gTCOZKxTvwTV0ANLSz8VdQYACo03E.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/xy/Xy8Yk--iYZNupHMjUtYX1AQ0BppsvThCh_ZAizblCb0.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/zu/zUCfHRTHprn06F5WxH6wp_BLs9-yhs-foc0j0Y7BYbg.cache +1 -0
- data/spec/internal/tmp/cache/assets/sprockets/v3.0/zx/ZX2IY3eKQjBy93tlH7_Xg7zGZKYuaQ-E8YPvtPT_4vM.cache +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-35.705.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-35.705.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.005.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.005.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.276.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.276.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.556.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.556.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.818.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-36.818.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.083.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.083.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.350.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.350.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.620.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.620.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.885.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-37.885.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-38.152.html +1 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-27-38.152.png +0 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-28-14.063.html +207 -0
- data/spec/internal/tmp/capybara/screenshot_2020-11-17-14-28-14.063.png +0 -0
- data/spec/quby/answers/entities/score_spec.rb +4 -0
- data/spec/quby/answers/services/answer_validations_spec.rb +8 -8
- data/spec/quby/answers/services/score_calculator_spec.rb +4 -14
- data/spec/quby/questionnaires/deserializer/questionnaire_spec.rb +237 -0
- data/spec/quby/questionnaires/dsl_spec.rb +0 -9
- data/spec/quby/questionnaires/entities/fields_spec.rb +3 -3
- data/spec/quby/questionnaires/entities/question_spec.rb +0 -8
- data/spec/quby/questionnaires/entities/questionnaire_spec.rb +2 -26
- data/spec/quby/table_backend/range_tree_spec.rb +46 -13
- data/spec/spec_helper.rb +1 -1
- metadata +230 -53
- data/lib/quby/lookup_table.rb +0 -29
- data/lib/quby/lookup_table_repo.rb +0 -24
- data/lib/quby/questionnaires/dsl/base.rb +0 -20
- data/lib/quby/questionnaires/dsl/calls_custom_methods.rb +0 -29
- data/lib/quby/questionnaires/dsl/charting/bar_chart_builder.rb +0 -18
- data/lib/quby/questionnaires/dsl/charting/chart_builder.rb +0 -91
- data/lib/quby/questionnaires/dsl/charting/line_chart_builder.rb +0 -57
- data/lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb +0 -31
- data/lib/quby/questionnaires/dsl/charting/radar_chart_builder.rb +0 -18
- data/lib/quby/questionnaires/dsl/helpers.rb +0 -51
- data/lib/quby/questionnaires/dsl/panel_builder.rb +0 -80
- data/lib/quby/questionnaires/dsl/question_builder.rb +0 -40
- data/lib/quby/questionnaires/dsl/questionnaire_builder.rb +0 -260
- data/lib/quby/questionnaires/dsl/questions/base.rb +0 -179
- data/lib/quby/questionnaires/dsl/questions/checkbox_question_builder.rb +0 -20
- data/lib/quby/questionnaires/dsl/questions/date_question_builder.rb +0 -18
- data/lib/quby/questionnaires/dsl/questions/deprecated_question_builder.rb +0 -18
- data/lib/quby/questionnaires/dsl/questions/float_question_builder.rb +0 -21
- data/lib/quby/questionnaires/dsl/questions/integer_question_builder.rb +0 -21
- data/lib/quby/questionnaires/dsl/questions/radio_question_builder.rb +0 -20
- data/lib/quby/questionnaires/dsl/questions/select_question_builder.rb +0 -18
- data/lib/quby/questionnaires/dsl/questions/string_question_builder.rb +0 -20
- data/lib/quby/questionnaires/dsl/questions/text_question_builder.rb +0 -22
- data/lib/quby/questionnaires/dsl/score_builder.rb +0 -22
- data/lib/quby/questionnaires/dsl/standardized_panel_generators.rb +0 -33
- data/lib/quby/questionnaires/dsl/table_builder.rb +0 -48
- data/lib/quby/questionnaires/services/definition_validator.rb +0 -298
- data/spec/benchmarks/load_normscore_csv.rb +0 -18
- data/spec/quby/lookup_table_repo_spec.rb +0 -20
- data/spec/quby/lookup_table_spec.rb +0 -38
- data/spec/quby/questionnaires/dsl/calls_custom_methods_spec.rb +0 -38
- data/spec/quby/questionnaires/dsl/charting/bar_chart_builder_spec.rb +0 -41
- data/spec/quby/questionnaires/dsl/charting/chart_builder_spec.rb +0 -127
- data/spec/quby/questionnaires/dsl/charting/line_chart_builder_spec.rb +0 -66
- data/spec/quby/questionnaires/dsl/charting/radar_chart_builder_spec.rb +0 -41
- data/spec/quby/questionnaires/dsl/helpers_spec.rb +0 -80
- data/spec/quby/questionnaires/dsl/questionnaire_builder_spec.rb +0 -480
- data/spec/quby/questionnaires/services/definition_validator_spec.rb +0 -793
- data/spec/support/examples_for_chart_builders.rb +0 -59
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class CheckboxQuestionBuilder < Base
|
8
|
-
include MultipleChoice
|
9
|
-
include Subquestions
|
10
|
-
include InnerTitles
|
11
|
-
|
12
|
-
def initialize(key, options = {}, &block)
|
13
|
-
super
|
14
|
-
@question = Entities::Questions::CheckboxQuestion.new(key, options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class DateQuestionBuilder < Base
|
8
|
-
include MinMaxValidations
|
9
|
-
|
10
|
-
def initialize(key, options = {}, &block)
|
11
|
-
super
|
12
|
-
@question = Entities::Questions::DateQuestion.new(key, options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class DeprecatedQuestionBuilder < Base
|
8
|
-
include MultipleChoice
|
9
|
-
|
10
|
-
def initialize(key, options = {}, &block)
|
11
|
-
super
|
12
|
-
@question = Entities::Questions::DeprecatedQuestion.new(key, options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class FloatQuestionBuilder < Base
|
8
|
-
include MinMaxValidations
|
9
|
-
include Labeling
|
10
|
-
include Units
|
11
|
-
include Sizes
|
12
|
-
|
13
|
-
def initialize(key, options = {}, &block)
|
14
|
-
super
|
15
|
-
@question = Entities::Questions::FloatQuestion.new(key, options)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class IntegerQuestionBuilder < Base
|
8
|
-
include MinMaxValidations
|
9
|
-
include Labeling
|
10
|
-
include Units
|
11
|
-
include Sizes
|
12
|
-
|
13
|
-
def initialize(key, options = {}, &block)
|
14
|
-
super
|
15
|
-
@question = Entities::Questions::IntegerQuestion.new(key, options)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class RadioQuestionBuilder < Base
|
8
|
-
include MultipleChoice
|
9
|
-
include Subquestions
|
10
|
-
include InnerTitles
|
11
|
-
|
12
|
-
def initialize(key, options = {}, &block)
|
13
|
-
super
|
14
|
-
@question = Entities::Questions::RadioQuestion.new(key, options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class SelectQuestionBuilder < Base
|
8
|
-
include MultipleChoice
|
9
|
-
|
10
|
-
def initialize(key, options = {}, &block)
|
11
|
-
super
|
12
|
-
@question = Entities::Questions::SelectQuestion.new(key, options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class StringQuestionBuilder < Base
|
8
|
-
include RegexpValidations
|
9
|
-
include Units
|
10
|
-
include Sizes
|
11
|
-
|
12
|
-
def initialize(key, options = {}, &block)
|
13
|
-
super
|
14
|
-
@question = Entities::Questions::StringQuestion.new(key, options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Quby
|
4
|
-
module Questionnaires
|
5
|
-
module DSL
|
6
|
-
module Questions
|
7
|
-
class TextQuestionBuilder < Base
|
8
|
-
include RegexpValidations
|
9
|
-
|
10
|
-
def initialize(key, options = {}, &block)
|
11
|
-
super
|
12
|
-
@question = Entities::Questions::TextQuestion.new(key, options)
|
13
|
-
end
|
14
|
-
|
15
|
-
def lines(value)
|
16
|
-
@question.lines = value
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'quby/questionnaires/entities'
|
4
|
-
|
5
|
-
module Quby
|
6
|
-
module Questionnaires
|
7
|
-
module DSL
|
8
|
-
class ScoreBuilder
|
9
|
-
attr_reader :key
|
10
|
-
attr_reader :calculation
|
11
|
-
|
12
|
-
def initialize(key, options = {}, &block)
|
13
|
-
@score = Entities::ScoreCalculation.new(key, options, &block)
|
14
|
-
end
|
15
|
-
|
16
|
-
def build
|
17
|
-
@score
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# rubocop:disable LineLength
|
4
|
-
|
5
|
-
module Quby
|
6
|
-
module Questionnaires
|
7
|
-
module DSL
|
8
|
-
module StandardizedPanelGenerators
|
9
|
-
def start_panel
|
10
|
-
panel do
|
11
|
-
text "Welkom bij deze vragenlijst"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def end_panel
|
16
|
-
panel do
|
17
|
-
text "*Bedankt voor het invullen van deze vragenlijst.*<br>
|
18
|
-
* U kunt uw antwoorden downloaden door op de knop 'Download als PDF' te klikken. Dit bestand is ook geschikt om af te drukken.<br>
|
19
|
-
* Sla de antwoorden op door op de 'Klaar'-knop onderaan te klikken. Daarna kunt u uw antwoorden niet meer wijzigen."
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def informal_end_panel
|
24
|
-
panel do
|
25
|
-
text "*Bedankt voor het invullen van deze vragenlijst.*<br>
|
26
|
-
* Je kan je antwoorden downloaden door op de knop 'Download als PDF' te klikken. Dit bestand is ook geschikt om af te drukken.<br>
|
27
|
-
* Sla de antwoorden op door op de 'Klaar'-knop onderaan te klikken. Daarna kun je je antwoorden niet meer wijzigen."
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'quby/questionnaires/entities'
|
4
|
-
|
5
|
-
module Quby
|
6
|
-
module Questionnaires
|
7
|
-
module DSL
|
8
|
-
class TableBuilder
|
9
|
-
prepend CallsCustomMethods
|
10
|
-
include Helpers
|
11
|
-
|
12
|
-
def initialize(panel, options = {})
|
13
|
-
@panel = panel
|
14
|
-
@table = Entities::Table.new(options)
|
15
|
-
@default_question_options = options[:default_question_options] || {}
|
16
|
-
@panel.items << @table
|
17
|
-
end
|
18
|
-
|
19
|
-
def title(value)
|
20
|
-
@table.title = value
|
21
|
-
end
|
22
|
-
|
23
|
-
def description(value)
|
24
|
-
@table.description = value
|
25
|
-
end
|
26
|
-
|
27
|
-
def text(value, options = {})
|
28
|
-
@table.items << Entities::Text.new(value.to_s, options)
|
29
|
-
end
|
30
|
-
|
31
|
-
def question(key, options = {}, &block)
|
32
|
-
options = @default_question_options.merge(options)
|
33
|
-
.merge(table: @table,
|
34
|
-
questionnaire: @panel.questionnaire)
|
35
|
-
|
36
|
-
check_question_keys_uniqueness key, options, @panel.questionnaire
|
37
|
-
fail "You can't create a slider in a table at the moment" if options[:as] == :slider
|
38
|
-
|
39
|
-
question = QuestionBuilder.build(key, options, &block)
|
40
|
-
|
41
|
-
@panel.questionnaire.register_question(question)
|
42
|
-
@table.items << question
|
43
|
-
@panel.items << question
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,298 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'nokogumbo'
|
3
|
-
require 'active_model'
|
4
|
-
require 'quby/questionnaires/entities/questionnaire'
|
5
|
-
|
6
|
-
module Quby
|
7
|
-
module Questionnaires
|
8
|
-
module Services
|
9
|
-
class DefinitionValidator < ActiveModel::Validator
|
10
|
-
MAX_KEY_LENGTH = 19
|
11
|
-
KEY_PREFIX = 'v_'
|
12
|
-
|
13
|
-
attr_reader :definition
|
14
|
-
attr_reader :questionnaire
|
15
|
-
|
16
|
-
def validate(definition)
|
17
|
-
questionnaire = DSL.build_from_definition(definition)
|
18
|
-
validate_fields(questionnaire)
|
19
|
-
validate_title(questionnaire)
|
20
|
-
validate_questions(questionnaire)
|
21
|
-
validate_scores(questionnaire)
|
22
|
-
validate_table_edgecases(questionnaire)
|
23
|
-
validate_flags(questionnaire)
|
24
|
-
validate_respondent_types(questionnaire)
|
25
|
-
validate_outcome_tables(questionnaire)
|
26
|
-
validate_markdown_fields(questionnaire) if questionnaire.validate_html
|
27
|
-
validate_raw_content_items(questionnaire) if questionnaire.validate_html
|
28
|
-
# Some compilation errors are Exceptions (pure syntax errors) and some StandardErrors (NameErrors)
|
29
|
-
rescue Exception => exception # rubocop:disable Lint/RescueException
|
30
|
-
definition.errors.add(:sourcecode, {message: "Questionnaire error: #{definition.key}\n" \
|
31
|
-
"#{exception.message}",
|
32
|
-
backtrace: exception.backtrace[0..5].join("<br/>")})
|
33
|
-
end
|
34
|
-
|
35
|
-
def validate_fields(questionnaire)
|
36
|
-
questionnaire.fields.input_keys
|
37
|
-
.find { |k| !k.is_a?(Symbol) }
|
38
|
-
&.tap { |k| fail "Input key #{k} is not a symbol" }
|
39
|
-
questionnaire.fields.answer_keys
|
40
|
-
.find { |k| !k.is_a?(Symbol) }
|
41
|
-
&.tap { |k| fail "Answer key #{k} is not a symbol" }
|
42
|
-
end
|
43
|
-
|
44
|
-
def validate_title(questionnaire)
|
45
|
-
if questionnaire.title.blank?
|
46
|
-
fail "Questionnaire title is missing."
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def validate_questions(questionnaire)
|
51
|
-
questionnaire.answer_keys.each do |key|
|
52
|
-
validate_key_format(key)
|
53
|
-
end
|
54
|
-
|
55
|
-
questionnaire.question_hash.each_value do |question|
|
56
|
-
validate_question(question)
|
57
|
-
subquestions_cant_have_default_invisible question
|
58
|
-
validate_subquestion_absence_in_select question
|
59
|
-
validate_placeholder_options_nil_values question
|
60
|
-
validate_values_unique question
|
61
|
-
|
62
|
-
validate_question_options(questionnaire, question)
|
63
|
-
validate_presence_of_titles question
|
64
|
-
validate_no_spaces_before_question_nr_in_title question
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def validate_question(question)
|
69
|
-
unless question.valid?
|
70
|
-
fail "Question #{question.key} is invalid: #{question.errors.full_messages.join(', ')}"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def validate_scores(questionnaire)
|
75
|
-
questionnaire.scores.each do |score|
|
76
|
-
validate_score_key_length(score)
|
77
|
-
validate_score_label_present(score)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def validate_question_options(questionnaire, question)
|
82
|
-
question.options.each do |option|
|
83
|
-
msg_base = "Question #{option.question.key} option #{option.key}"
|
84
|
-
to_be_hidden_questions_exist_and_not_subquestion?(questionnaire, option, msg_base: msg_base)
|
85
|
-
to_be_shown_questions_exist_and_not_subquestion?(questionnaire, option, msg_base: msg_base)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def validate_presence_of_titles(question)
|
90
|
-
return if question.allow_blank_titles
|
91
|
-
if !question.subquestion? && question.title.blank? && question.context_free_title.blank?
|
92
|
-
fail "Question #{question.key} must define either `:title` or `:context_free_title`."
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def validate_table_edgecases(questionnaire)
|
97
|
-
questionnaire.panels.each do |panel|
|
98
|
-
tables = panel.items.select { |item| item.is_a?(Entities::Table) }
|
99
|
-
tables.each do |table|
|
100
|
-
questions = table.items.select { |item| item.is_a?(Entities::Question) }
|
101
|
-
questions.each { |question| validate_table_question(question) }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def validate_flags(questionnaire)
|
107
|
-
questionnaire.flags.each_value do |flag|
|
108
|
-
validate_flag_shows(questionnaire, flag)
|
109
|
-
validate_flag_hides(questionnaire, flag)
|
110
|
-
validate_flag_depends_on(questionnaire, flag)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def validate_flag_shows(questionnaire, flag)
|
115
|
-
unknown_questions = flag.shows_questions.select { |key| !questionnaire.key_in_use?(key) }
|
116
|
-
return if unknown_questions.blank?
|
117
|
-
|
118
|
-
fail ArgumentError, "Flag '#{key}' has unknown shows_questions keys #{unknown_questions}"
|
119
|
-
end
|
120
|
-
|
121
|
-
def validate_flag_hides(questionnaire, flag)
|
122
|
-
unknown_questions = flag.hides_questions.select { |key| !questionnaire.key_in_use?(key) }
|
123
|
-
return if unknown_questions.blank?
|
124
|
-
|
125
|
-
fail ArgumentError, "Flag '#{key}' has unknown hides_questions keys #{unknown_questions}"
|
126
|
-
end
|
127
|
-
|
128
|
-
def validate_flag_depends_on(questionnaire, flag)
|
129
|
-
return if flag.depends_on.blank? || questionnaire.flags.key?(flag.depends_on)
|
130
|
-
|
131
|
-
fail ArgumentError, "Flag #{flag.key} depends_on nonexistent flag '#{flag.depends_on}'"
|
132
|
-
end
|
133
|
-
|
134
|
-
def validate_respondent_types(questionnaire)
|
135
|
-
valid_respondent_types = Entities::Questionnaire::RESPONDENT_TYPES
|
136
|
-
|
137
|
-
invalid_types = questionnaire.respondent_types - valid_respondent_types
|
138
|
-
|
139
|
-
if invalid_types.present?
|
140
|
-
fail "Invalid respondent types: :#{invalid_types.join(', :')}\n"\
|
141
|
-
"Choose one or more from: :#{valid_respondent_types.join(', :')}"
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def validate_outcome_tables(questionnaire)
|
146
|
-
questionnaire.outcome_tables.each do |table|
|
147
|
-
next if table.valid?
|
148
|
-
fail "Outcome table #{table.errors.full_messages}"
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def to_be_hidden_questions_exist_and_not_subquestion?(questionnaire, option, msg_base:)
|
153
|
-
return if option.hides_questions.blank?
|
154
|
-
msg_base += " hides_questions"
|
155
|
-
option.hides_questions.each do |key|
|
156
|
-
validate_question_key_exists?(questionnaire, key, msg_base: msg_base)
|
157
|
-
validate_not_subquestion(questionnaire, key, msg_base: msg_base)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
def to_be_shown_questions_exist_and_not_subquestion?(questionnaire, option, msg_base:)
|
162
|
-
return if option.shows_questions.blank?
|
163
|
-
msg_base += " shows_questions"
|
164
|
-
option.shows_questions.each do |key|
|
165
|
-
validate_question_key_exists?(questionnaire, key, msg_base: msg_base)
|
166
|
-
validate_not_subquestion(questionnaire, key, msg_base: msg_base)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def subquestions_cant_have_default_invisible(question)
|
171
|
-
if question.subquestion? && question.default_invisible
|
172
|
-
fail "Question #{question.key} is a subquestion with default_invisible."
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
private
|
177
|
-
|
178
|
-
# Don't write question numbers as " 1. Title", but as "1\\. Title".
|
179
|
-
def validate_no_spaces_before_question_nr_in_title(question)
|
180
|
-
if question.title && question.title.match(/^\s{2,}\d+\\\./)
|
181
|
-
fail "Question with number does not need leading spaces."
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def validate_question_key_exists?(questionnaire, key, msg_base:)
|
186
|
-
unless questionnaire.question_hash[key]
|
187
|
-
fail msg_base + " references nonexistent question #{key}"
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def validate_not_subquestion(questionnaire, key, msg_base:)
|
192
|
-
if questionnaire.question_hash[key].subquestion?
|
193
|
-
fail msg_base + " references subquestion #{key}"
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
def validate_key_format(key)
|
198
|
-
if key.to_s.length > MAX_KEY_LENGTH
|
199
|
-
fail "Key '#{key}' should contain at most #{MAX_KEY_LENGTH} characters."
|
200
|
-
end
|
201
|
-
unless key.to_s.start_with?(KEY_PREFIX)
|
202
|
-
fail "Key '#{key}' should start with '#{KEY_PREFIX}'."
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def validate_score_key_length(score)
|
207
|
-
if score.key.to_s.length > MAX_KEY_LENGTH
|
208
|
-
fail "Score key `#{score.key}` should contain at most #{MAX_KEY_LENGTH} characters."
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def validate_score_label_present(score)
|
213
|
-
fail "Score #{score.key} label must be passed in as an option." unless score.label.present?
|
214
|
-
end
|
215
|
-
|
216
|
-
def validate_subquestion_absence_in_select(question)
|
217
|
-
return unless question.type == :select
|
218
|
-
question.options.each do |option|
|
219
|
-
unless option.questions.empty?
|
220
|
-
fail "Question '#{question.key}' of type ':select' may not include other questions."
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
def validate_placeholder_options_nil_values(question)
|
226
|
-
question.options.each do |question_option|
|
227
|
-
if question_option.placeholder && question_option.value.present?
|
228
|
-
fail "#{question.key}:#{question_option.key}: Placeholder options should not have values defined."
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
def validate_values_unique(question)
|
234
|
-
return if question.type == :check_box || question.allow_duplicate_option_values
|
235
|
-
|
236
|
-
question.options.each_with_object([]) do |question_option, seen_values|
|
237
|
-
next if question_option.placeholder || question_option.inner_title
|
238
|
-
|
239
|
-
fail "#{question.key}:#{question_option.key}: Has no option value defined." if question_option.value.blank?
|
240
|
-
if seen_values.include?(question_option.value)
|
241
|
-
fail "#{question.key}:#{question_option.key}: " \
|
242
|
-
"Another option with value #{question_option.value} is already defined."
|
243
|
-
end
|
244
|
-
seen_values << question_option.value
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
def validate_table_question(question)
|
249
|
-
question.subquestions.each do |subquestion|
|
250
|
-
if subquestion.presentation != :next_to_title
|
251
|
-
fail "Question #{question.key} is inside a table, but has a subquestion #{subquestion.key}, " \
|
252
|
-
"which is not allowed."
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
def validate_markdown_fields(questionnaire)
|
258
|
-
questionnaire.panels.each do |panel|
|
259
|
-
panel.items.select { |item| item.is_a?(Entities::Text) }.each do |text_item|
|
260
|
-
validate_markdown(text_item.str, text_item.str)
|
261
|
-
end
|
262
|
-
end
|
263
|
-
questionnaire.questions.each do |question|
|
264
|
-
Entities::Question::MARKDOWN_ATTRIBUTES.each do |attr|
|
265
|
-
validate_markdown(question.send(attr), "#{question.key}.#{attr}")
|
266
|
-
question.options.each do |option|
|
267
|
-
Entities::QuestionOption::MARKDOWN_ATTRIBUTES.each do |option_attr|
|
268
|
-
validate_markdown(option.send(option_attr), "#{question.key}:#{option.key}.#{option_attr}")
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
def validate_raw_content_items(questionnaire)
|
276
|
-
questionnaire.panels.each do |panel|
|
277
|
-
panel.items.each do |item|
|
278
|
-
next if item.raw_content.blank?
|
279
|
-
|
280
|
-
validate_html(item.raw_content)
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
|
-
def validate_markdown(markdown, key)
|
286
|
-
validate_html(MarkdownParser.new(markdown).to_html, key)
|
287
|
-
end
|
288
|
-
|
289
|
-
def validate_html(html, key = nil)
|
290
|
-
fragment = Nokogiri::HTML5.fragment(html, max_errors: 3)
|
291
|
-
return unless fragment.errors.present?
|
292
|
-
|
293
|
-
fail "#{key || html} contains invalid html: #{fragment.errors.map(&:to_s).join(', ')}."
|
294
|
-
end
|
295
|
-
end
|
296
|
-
end
|
297
|
-
end
|
298
|
-
end
|