From 04fce0cddecd6a303f46f35c2aa673815eb2a575 Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Mon, 3 Oct 2022 12:21:34 -0400 Subject: [PATCH 1/9] Add multi-phase download feature and fix a Webmock complain --- app/controllers/plan_exports_controller.rb | 16 +- app/controllers/plans_controller.rb | 5 +- app/javascript/src/plans/download.js | 12 +- app/views/shared/export/_plan.erb | 2 +- app/views/shared/export/_plan_txt.erb | 2 +- db/schema.rb | 692 ++++++--------------- spec/features/plans/exports_spec.rb | 165 +++-- spec/rails_helper.rb | 2 +- spec/spec_helper.rb | 4 +- 9 files changed, 347 insertions(+), 553 deletions(-) diff --git a/app/controllers/plan_exports_controller.rb b/app/controllers/plan_exports_controller.rb index b034aa6b51..235460b7f4 100644 --- a/app/controllers/plan_exports_controller.rb +++ b/app/controllers/plan_exports_controller.rb @@ -36,12 +36,18 @@ def show @hash = @plan.as_pdf(current_user, @show_coversheet) @formatting = export_params[:formatting] || @plan.settings(:export).formatting - @selected_phase = if params.key?(:phase_id) - @plan.phases.find(params[:phase_id]) - else - @plan.phases.order('phases.updated_at DESC') + if params.key?(:phase_id) + # order phases by phase number asc + @hash[:phases] = @hash[:phases].sort_by{|phase| phase[:number]} + if (params[:phase_id] == "All") + @hash[:all_phases] = true + else + @selected_phase = @plan.phases.find(params[:phase_id]) + end + else + @plan.phases.order("phases.updated_at DESC") .detect { |p| p.visibility_allowed?(@plan) } - end + end # Added contributors to coverage of plans. # Users will see both roles and contributor names if the role is filled diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 623cf2477f..5d611d0e20 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -376,8 +376,11 @@ def download @plan = Plan.find(params[:id]) authorize @plan @phase_options = @plan.phases.order(:number).pluck(:title, :id) + if @phase_options.length > 1 + @phase_options.insert(0,["All phases", "All"]) + end @export_settings = @plan.settings(:export) - render 'download' + render "download" end # POST /plans/:id/duplicate diff --git a/app/javascript/src/plans/download.js b/app/javascript/src/plans/download.js index e772b83221..6e1440f04c 100644 --- a/app/javascript/src/plans/download.js +++ b/app/javascript/src/plans/download.js @@ -21,5 +21,15 @@ $(() => { } else { $('#download-settings').show(); } - }); + + if (frmt === 'csv') { + $('#phase_id').find('option[value="All"').hide(); + $('#phase_id option:eq(1)').attr('selected', 'selected'); + $('#phase_id').val($('#phase_id option:eq(1)').val()); + } else if (frmt === 'pdf' || frmt === 'html' || frmt === 'docx' || frmt === 'text') { + $('#phase_id').find('option[value="All"').show(); + $('#phase_id').val($('#phase_id option:first').val()); + $('#phase_id option:first').attr('selected', 'selected'); + } + }).trigger('change'); }); diff --git a/app/views/shared/export/_plan.erb b/app/views/shared/export/_plan.erb index dac27560f2..aae3b9b705 100644 --- a/app/views/shared/export/_plan.erb +++ b/app/views/shared/export/_plan.erb @@ -18,7 +18,7 @@ <% @hash[:phases].each do |phase| %> <%# Only render selected phase %> - <% if phase[:title] == @selected_phase.title %> + <% if @hash[:all_phases] || (@selected_phase.present? && phase[:title] == @selected_phase.title) %> <%# Page break before each phase %>

<%= download_plan_page_title(@plan, phase, @hash) %>

diff --git a/app/views/shared/export/_plan_txt.erb b/app/views/shared/export/_plan_txt.erb index 7a9c42b87f..ff8570c785 100644 --- a/app/views/shared/export/_plan_txt.erb +++ b/app/views/shared/export/_plan_txt.erb @@ -38,7 +38,7 @@ <% @hash[:phases].each do |phase| %> <%# Only render selected phase %> -<% if phase[:title] == @selected_phase.title %> +<% if @hash[:all_phases] || (@selected_phase.present? && phase[:title] == @selected_phase.title) %> <%= (@hash[:phases].length > 1 ? "#{phase[:title]}" : "") %> <% phase[:sections].each do |section| %> <% if display_section?(@hash[:customization], section, @show_custom_sections) && num_section_questions(@plan, section, phase) > 0 %> diff --git a/db/schema.rb b/db/schema.rb index 56dbfef7d4..fc2833ad17 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,207 +2,103 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2022_03_15_104737) do - create_table "annotations", id: :integer, force: :cascade do |t| - t.integer "question_id" - t.integer "org_id" - t.text "text" - t.integer "type", default: 0, null: false - t.datetime "created_at" - t.datetime "updated_at" - t.string "versionable_id", limit: 36 - t.index ["org_id"], name: "fk_rails_aca7521f72" - t.index ["question_id"], name: "index_annotations_on_question_id" - t.index ["versionable_id"], name: "index_annotations_on_versionable_id" - end +# Could not dump table "annotations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "answers", id: :integer, force: :cascade do |t| - t.text "text" - t.integer "plan_id" - t.integer "user_id" - t.integer "question_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "lock_version", default: 0 - t.index ["plan_id"], name: "fk_rails_84a6005a3e" - t.index ["plan_id"], name: "index_answers_on_plan_id" - t.index ["question_id"], name: "fk_rails_3d5ed4418f" - t.index ["question_id"], name: "index_answers_on_question_id" - t.index ["user_id"], name: "fk_rails_584be190c2" +# Could not dump table "answers" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + + create_table "answers_options", id: false, force: :cascade do |t| + t.integer "answer_id", null: false + t.integer "option_id", null: false + t.index ["answer_id", "option_id"], name: "index_answers_options_on_answer_id_and_option_id" end create_table "answers_question_options", id: false, force: :cascade do |t| t.integer "answer_id", null: false t.integer "question_option_id", null: false t.index ["answer_id"], name: "index_answers_question_options_on_answer_id" + t.index ["question_option_id"], name: "fk_rails_01ba00b569" end - create_table "api_clients", id: :integer, force: :cascade do |t| - t.string "name", null: false - t.string "description" - t.string "homepage" - t.string "contact_name" - t.string "contact_email" - t.string "client_id", null: false - t.string "client_secret", null: false - t.datetime "last_access" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "org_id" - t.text "redirect_uri" - t.string "scopes", default: "", null: false - t.boolean "confidential", default: true - t.boolean "trusted", default: false - t.integer "callback_method" - t.string "callback_uri" - t.index ["name"], name: "index_oauth_applications_on_name" - end +# Could not dump table "api_clients" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "conditions", id: :integer, force: :cascade do |t| - t.integer "question_id" - t.text "option_list" - t.integer "action_type" - t.integer "number" - t.text "remove_data" - t.text "webhook_data" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["question_id"], name: "index_conditions_on_question_id" - end +# Could not dump table "comments" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "contributors", id: :integer, force: :cascade do |t| - t.string "name" - t.string "email" - t.string "phone" - t.integer "roles", null: false - t.integer "org_id" - t.integer "plan_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.index ["email"], name: "index_contributors_on_email" - t.index ["name", "id", "org_id"], name: "index_contrib_id_and_org_id" - t.index ["org_id"], name: "index_contributors_on_org_id" - t.index ["plan_id"], name: "index_contributors_on_plan_id" - t.index ["roles"], name: "index_contributors_on_roles" - end +# Could not dump table "conditions" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "departments", id: :integer, force: :cascade do |t| - t.string "name" - t.string "code" - t.integer "org_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["org_id"], name: "index_departments_on_org_id" - end +# Could not dump table "contributors" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "exported_plans", id: :integer, force: :cascade do |t| - t.integer "plan_id" - t.integer "user_id" - t.string "format" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "phase_id" - end +# Could not dump table "departments" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "external_api_access_tokens", force: :cascade do |t| - t.bigint "user_id", null: false - t.string "external_service_name", null: false - t.string "access_token", null: false - t.string "refresh_token" - t.datetime "expires_at" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["expires_at"], name: "index_external_api_access_tokens_on_expires_at" - t.index ["external_service_name"], name: "index_external_api_access_tokens_on_external_service_name" - t.index ["user_id", "external_service_name"], name: "index_external_tokens_on_user_and_service" - t.index ["user_id"], name: "index_external_api_access_tokens_on_user_id" - end +# Could not dump table "dmptemplate_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "guidance_groups", id: :integer, force: :cascade do |t| - t.string "name" - t.integer "org_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "optional_subset", default: false, null: false - t.boolean "published", default: false, null: false - t.index ["org_id"], name: "index_guidance_groups_on_org_id" - end +# Could not dump table "dmptemplates" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "guidances", id: :integer, force: :cascade do |t| - t.text "text" + create_table "dmptemplates_guidance_groups", id: false, force: :cascade do |t| + t.integer "dmptemplate_id" t.integer "guidance_group_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "published" - t.index ["guidance_group_id"], name: "index_guidances_on_guidance_group_id" end - create_table "identifier_schemes", id: :integer, force: :cascade do |t| - t.string "name" - t.string "description" - t.boolean "active" - t.datetime "created_at" - t.datetime "updated_at" - t.string "logo_url" - t.string "identifier_prefix" - t.integer "context" - t.string "external_service" - end +# Could not dump table "exported_plans" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "identifiers", id: :integer, force: :cascade do |t| - t.string "value", null: false - t.text "attrs" - t.integer "identifier_scheme_id" - t.integer "identifiable_id" - t.string "identifiable_type" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["identifiable_type", "identifiable_id"], name: "index_identifiers_on_identifiable_type_and_identifiable_id" - t.index ["identifier_scheme_id", "identifiable_id", "identifiable_type"], name: "index_identifiers_on_scheme_and_type_and_id" - t.index ["identifier_scheme_id", "value"], name: "index_identifiers_on_identifier_scheme_id_and_value" - end +# Could not dump table "file_types" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "languages", id: :integer, force: :cascade do |t| - t.string "abbreviation" - t.string "description" - t.string "name" - t.boolean "default_language" - end +# Could not dump table "file_uploads" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "licenses", force: :cascade do |t| - t.string "name", null: false - t.string "identifier", null: false - t.string "uri", null: false - t.boolean "osi_approved", default: false - t.boolean "deprecated", default: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["identifier", "osi_approved", "deprecated"], name: "index_license_on_identifier_and_criteria" - t.index ["identifier"], name: "index_licenses_on_identifier" - t.index ["uri"], name: "index_licenses_on_uri" - end +# Could not dump table "friendly_id_slugs" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "metadata_standards", force: :cascade do |t| - t.string "title" - t.text "description" - t.string "rdamsc_id" - t.string "uri" - t.json "locations" - t.json "related_entities" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false +# Could not dump table "guidance_groups" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + + create_table "guidance_in_group", id: false, force: :cascade do |t| + t.integer "guidance_id", null: false + t.integer "guidance_group_id", null: false + t.index ["guidance_id", "guidance_group_id"], name: "index_guidance_in_group_on_guidance_id_and_guidance_group_id" end +# Could not dump table "guidance_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "guidances" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "identifier_schemes" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "identifiers" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "languages" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "licenses" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "metadata_standards" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "metadata_standards_research_outputs", force: :cascade do |t| t.bigint "metadata_standard_id" t.bigint "research_output_id" @@ -210,17 +106,8 @@ t.index ["research_output_id"], name: "metadata_research_outputs_on_ro" end - create_table "notes", id: :integer, force: :cascade do |t| - t.integer "user_id" - t.text "text" - t.boolean "archived", default: false, null: false - t.integer "answer_id" - t.integer "archived_by" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["answer_id"], name: "index_notes_on_answer_id" - t.index ["user_id"], name: "fk_rails_7f2323ad43" - end +# Could not dump table "notes" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "notification_acknowledgements", id: :integer, force: :cascade do |t| t.integer "user_id" @@ -231,18 +118,14 @@ t.index ["user_id"], name: "index_notification_acknowledgements_on_user_id" end - create_table "notifications", id: :integer, force: :cascade do |t| - t.integer "notification_type" - t.string "title" - t.integer "level" - t.text "body" - t.boolean "dismissable" - t.date "starts_at" - t.date "expires_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "enabled", default: true - end +# Could not dump table "notifications" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "option_warnings" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "options" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "org_token_permissions", id: :integer, force: :cascade do |t| t.integer "org_id" @@ -253,179 +136,97 @@ t.index ["token_permission_type_id"], name: "fk_rails_2aa265f538" end - create_table "orgs", id: :integer, force: :cascade do |t| - t.string "name" - t.string "abbreviation" - t.string "target_url" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "is_other", default: false, null: false - t.integer "region_id" - t.integer "language_id" - t.string "logo_uid" - t.string "logo_name" - t.string "contact_email" - t.integer "org_type", default: 0, null: false - t.text "links" - t.boolean "feedback_enabled", default: false - t.text "feedback_msg" - t.string "contact_name" - t.boolean "managed", default: false, null: false - t.string "api_create_plan_email_subject" - t.text "api_create_plan_email_body" - t.index ["language_id"], name: "fk_rails_5640112cab" - t.index ["region_id"], name: "fk_rails_5a6adf6bab" - t.string "helpdesk_email" - end +# Could not dump table "organisation_types" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "organisations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "orgs" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "perms", id: :integer, force: :cascade do |t| - t.string "name" +# Could not dump table "perms" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "phase_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "phases" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + + create_table "plan_sections", id: :integer, force: :cascade do |t| + t.integer "user_id" + t.integer "section_id" + t.integer "plan_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.datetime "release_time" end - create_table "phases", id: :integer, force: :cascade do |t| - t.string "title" - t.text "description" - t.integer "number" - t.integer "template_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "modifiable" - t.string "versionable_id", limit: 36 - t.index ["template_id"], name: "index_phases_on_template_id" - t.index ["versionable_id"], name: "index_phases_on_versionable_id" - end - - create_table "plans", id: :integer, force: :cascade do |t| - t.string "title" - t.integer "template_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "identifier" - t.text "description" - t.integer "visibility", default: 3, null: false - t.boolean "feedback_requested", default: false - t.boolean "complete", default: false - t.integer "org_id" - t.integer "funder_id" - t.integer "grant_id" - t.integer "api_client_id" - t.datetime "start_date" - t.datetime "end_date" - t.boolean "ethical_issues" - t.text "ethical_issues_description" - t.string "ethical_issues_report" - t.integer "funding_status" - t.bigint "research_domain_id" - t.index ["funder_id"], name: "index_plans_on_funder_id" - t.index ["grant_id"], name: "index_plans_on_grant_id" - t.index ["org_id"], name: "index_plans_on_org_id" - t.index ["research_domain_id"], name: "index_plans_on_fos_id" - t.index ["template_id"], name: "index_plans_on_template_id" - t.index ["api_client_id"], name: "index_plans_on_api_client_id" - end +# Could not dump table "plans" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "plans_guidance_groups", id: :integer, force: :cascade do |t| t.integer "guidance_group_id" t.integer "plan_id" t.index ["guidance_group_id", "plan_id"], name: "index_plans_guidance_groups_on_guidance_group_id_and_plan_id" - t.index ["guidance_group_id"], name: "fk_rails_ec1c5524d7" t.index ["plan_id"], name: "fk_rails_13d0671430" end - create_table "prefs", id: :integer, force: :cascade do |t| - t.text "settings" - t.integer "user_id" - end +# Could not dump table "prefs" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "question_format_labels", id: false, force: :cascade do |t| - t.integer "id" - t.string "description" - t.integer "question_id" - t.integer "number" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "question_formats", id: :integer, force: :cascade do |t| - t.string "title" - t.text "description" + create_table "project_groups", id: :integer, force: :cascade do |t| + t.boolean "project_creator" + t.boolean "project_editor" + t.integer "user_id" + t.integer "project_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.boolean "option_based", default: false - t.integer "formattype", default: 0 + t.boolean "project_administrator" end - create_table "question_options", id: :integer, force: :cascade do |t| - t.integer "question_id" - t.string "text" - t.integer "number" - t.boolean "is_default" - t.datetime "created_at" - t.datetime "updated_at" - t.string "versionable_id", limit: 36 - t.index ["question_id"], name: "index_question_options_on_question_id" - t.index ["versionable_id"], name: "index_question_options_on_versionable_id" + create_table "project_guidance", id: false, force: :cascade do |t| + t.integer "project_id", null: false + t.integer "guidance_group_id", null: false + t.index ["project_id", "guidance_group_id"], name: "index_project_guidance_on_project_id_and_guidance_group_id" end - create_table "questions", id: :integer, force: :cascade do |t| - t.text "text" - t.text "default_value" - t.integer "number" - t.integer "section_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "question_format_id" - t.boolean "option_comment_display", default: true - t.boolean "modifiable" - t.string "versionable_id", limit: 36 - t.index ["question_format_id"], name: "fk_rails_4fbc38c8c7" - t.index ["section_id"], name: "index_questions_on_section_id" - t.index ["versionable_id"], name: "index_questions_on_versionable_id" - end +# Could not dump table "projects" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "question_format_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "question_formats" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "question_options" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "question_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "questions" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "questions_themes", id: false, force: :cascade do |t| t.integer "question_id", null: false t.integer "theme_id", null: false t.index ["question_id"], name: "index_questions_themes_on_question_id" + t.index ["theme_id"], name: "fk_rails_0489d5eeba" end - create_table "regions", id: :integer, force: :cascade do |t| - t.string "abbreviation" - t.string "description" - t.string "name" + create_table "region_groups", id: :integer, force: :cascade do |t| t.integer "super_region_id" + t.integer "region_id" end - create_table "related_identifiers", force: :cascade do |t| - t.bigint "identifier_scheme_id" - t.integer "identifier_type", null: false - t.integer "relation_type", null: false - t.bigint "identifiable_id" - t.string "identifiable_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "value", null: false - t.index ["identifiable_id", "identifiable_type", "relation_type"], name: "index_relateds_on_identifiable_and_relation_type" - t.index ["identifier_scheme_id"], name: "index_related_identifiers_on_identifier_scheme_id" - t.index ["identifier_type"], name: "index_related_identifiers_on_identifier_type" - t.index ["relation_type"], name: "index_related_identifiers_on_relation_type" - end +# Could not dump table "regions" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "repositories", force: :cascade do |t| - t.string "name", null: false - t.text "description", null: false - t.string "homepage" - t.string "contact" - t.string "uri", null: false - t.json "info" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["homepage"], name: "index_repositories_on_homepage" - t.index ["name"], name: "index_repositories_on_name" - t.index ["uri"], name: "index_repositories_on_uri" - end +# Could not dump table "repositories" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "repositories_research_outputs", force: :cascade do |t| t.bigint "research_output_id" @@ -434,36 +235,11 @@ t.index ["research_output_id"], name: "index_repositories_research_outputs_on_research_output_id" end - create_table "research_domains", force: :cascade do |t| - t.string "identifier", null: false - t.string "label", null: false - t.bigint "parent_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["parent_id"], name: "index_research_domains_on_parent_id" - end +# Could not dump table "research_domains" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "research_outputs", force: :cascade do |t| - t.integer "plan_id" - t.integer "output_type", default: 3, null: false - t.string "output_type_description" - t.string "title", null: false - t.string "abbreviation" - t.integer "display_order" - t.boolean "is_default" - t.text "description" - t.integer "access", default: 0, null: false - t.datetime "release_date" - t.boolean "personal_data" - t.boolean "sensitive_data" - t.bigint "byte_size" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.bigint "license_id" - t.index ["license_id"], name: "index_research_outputs_on_license_id" - t.index ["output_type"], name: "index_research_outputs_on_output_type" - t.index ["plan_id"], name: "index_research_outputs_on_plan_id" - end +# Could not dump table "research_outputs" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "roles", id: :integer, force: :cascade do |t| t.integer "user_id" @@ -476,89 +252,35 @@ t.index ["user_id"], name: "index_roles_on_user_id" end - create_table "sections", id: :integer, force: :cascade do |t| - t.string "title" - t.text "description" - t.integer "number" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "phase_id" - t.boolean "modifiable" - t.string "versionable_id", limit: 36 - t.index ["phase_id"], name: "index_sections_on_phase_id" - t.index ["versionable_id"], name: "index_sections_on_versionable_id" - end +# Could not dump table "section_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "sessions", id: :integer, force: :cascade do |t| - t.string "session_id", limit: 64, null: false - t.text "data" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["session_id"], name: "index_sessions_on_session_id", unique: true - t.index ["updated_at"], name: "index_sessions_on_updated_at" - end +# Could not dump table "sections" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "settings", id: :integer, force: :cascade do |t| - t.string "var" - t.text "value" - t.integer "target_id", null: false - t.string "target_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end +# Could not dump table "sessions" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "stats", id: :integer, force: :cascade do |t| - t.bigint "count", default: 0 - t.date "date", null: false - t.string "type", null: false - t.integer "org_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.text "details" - t.boolean "filtered", default: false - end +# Could not dump table "settings" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "subscriptions", force: :cascade do |t| - t.bigint "plan_id" - t.integer "subscription_types", null: false - t.string "callback_uri" - t.bigint "subscriber_id" - t.string "subscriber_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "last_notified" - t.index ["plan_id"], name: "index_subscriptions_on_plan_id" - t.index ["subscriber_id", "subscriber_type", "plan_id"], name: "index_subscribers_on_identifiable_and_plan_id" - end +# Could not dump table "splash_logs" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "templates", id: :integer, force: :cascade do |t| - t.string "title" - t.text "description" - t.boolean "published" - t.integer "org_id" - t.string "locale" - t.boolean "is_default" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "version" - t.integer "visibility" - t.integer "customization_of" - t.integer "family_id" - t.boolean "archived" - t.text "links" - t.index ["family_id", "version"], name: "index_templates_on_family_id_and_version", unique: true - t.index ["family_id"], name: "index_templates_on_family_id" - t.index ["org_id", "family_id"], name: "template_organisation_dmptemplate_index" - t.index ["org_id"], name: "index_templates_on_org_id" - end +# Could not dump table "stats" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "themes", id: :integer, force: :cascade do |t| - t.string "title" - t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "locale" - end +# Could not dump table "stylesheets" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "suggested_answers" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "templates" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "themes" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "themes_in_guidance", id: false, force: :cascade do |t| t.integer "theme_id" @@ -567,61 +289,23 @@ t.index ["theme_id"], name: "index_themes_in_guidance_on_theme_id" end - create_table "token_permission_types", id: :integer, force: :cascade do |t| - t.string "token_type" - t.text "text_description" - t.datetime "created_at" - t.datetime "updated_at" - end +# Could not dump table "token_permission_types" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "trackers", id: :integer, force: :cascade do |t| - t.integer "org_id" - t.string "code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["org_id"], name: "index_trackers_on_org_id" - end +# Could not dump table "trackers" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - create_table "users", id: :integer, force: :cascade do |t| - t.string "firstname" - t.string "surname" - t.string "email", limit: 80, default: "", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "encrypted_password" - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" - t.string "invitation_token" - t.datetime "invitation_created_at" - t.datetime "invitation_sent_at" - t.datetime "invitation_accepted_at" - t.string "other_organisation" - t.boolean "accept_terms" - t.integer "org_id" - t.string "api_token" - t.integer "invited_by_id" - t.string "invited_by_type" - t.integer "language_id" - t.string "recovery_email" - t.string "ldap_password" - t.string "ldap_username" - t.boolean "active", default: true - t.integer "department_id" - t.datetime "last_api_access" - t.index ["department_id"], name: "fk_rails_f29bf9cdf2" - t.index ["email"], name: "index_users_on_email" - t.index ["language_id"], name: "fk_rails_45f4f12508" - t.index ["org_id"], name: "index_users_on_org_id" - end +# Could not dump table "user_role_types" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "user_statuses" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "user_types" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "users" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 create_table "users_perms", id: false, force: :cascade do |t| t.integer "user_id" @@ -630,11 +314,25 @@ t.index ["user_id"], name: "index_users_perms_on_user_id" end + create_table "users_roles", id: false, force: :cascade do |t| + t.integer "user_id" + t.integer "role_id" + t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id" + end + +# Could not dump table "version_translations" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + +# Could not dump table "versions" because of following ActiveRecord::StatementInvalid +# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + add_foreign_key "annotations", "orgs" add_foreign_key "annotations", "questions" add_foreign_key "answers", "plans" add_foreign_key "answers", "questions" add_foreign_key "answers", "users" + add_foreign_key "answers_question_options", "answers" + add_foreign_key "answers_question_options", "question_options" add_foreign_key "conditions", "questions" add_foreign_key "guidance_groups", "orgs" add_foreign_key "guidances", "guidance_groups" @@ -654,6 +352,8 @@ add_foreign_key "question_options", "questions" add_foreign_key "questions", "question_formats" add_foreign_key "questions", "sections" + add_foreign_key "questions_themes", "questions" + add_foreign_key "questions_themes", "themes" add_foreign_key "research_domains", "research_domains", column: "parent_id" add_foreign_key "research_outputs", "licenses" add_foreign_key "roles", "plans" @@ -666,4 +366,6 @@ add_foreign_key "users", "departments" add_foreign_key "users", "languages" add_foreign_key "users", "orgs" + add_foreign_key "users_perms", "perms" + add_foreign_key "users_perms", "users" end diff --git a/spec/features/plans/exports_spec.rb b/spec/features/plans/exports_spec.rb index 4feec44845..85cd14a8d7 100644 --- a/spec/features/plans/exports_spec.rb +++ b/spec/features/plans/exports_spec.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true -require 'rails_helper' +require "rails_helper" + +RSpec.describe "PlansExports", type: :feature, js: true do -RSpec.describe 'PlansExports', type: :feature, js: true do let!(:template) { create(:template, phases: 2) } let!(:org) { create(:org, managed: true, is_other: false) } let!(:user) { create(:user, org: org) } @@ -16,7 +17,7 @@ sign_in(user) end - scenario 'User downloads plan from organisational plans portion of the dashboard' do + scenario "User downloads plan from organisational plans portion of the dashboard" do new_plan = create(:plan, :publicly_visible, template: template) new_phase = create(:phase, template: template, sections: 2) new_phase.sections do |sect| @@ -34,99 +35,171 @@ find(:css, "a[href*=\"/#{new_plan.id}/export.pdf\"]", visible: false).click end - scenario 'User downloads public plan belonging to other User' do + scenario "User downloads public plan belonging to other User" do new_plan = create(:plan, :publicly_visible, template: template) create(:role, :creator, plan: new_plan) sign_in(user) within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" end - select('html') - new_window = window_opened_by { click_button 'Download Plan' } + select("html") + new_window = window_opened_by { click_button "Download Plan" } within_window new_window do expect(page.source).to have_text(plan.title) end end - scenario 'User downloads org plan belonging to User in same org' do + scenario "User downloads org plan belonging to User in same org" do new_plan = create(:plan, :organisationally_visible, template: template) create(:role, :creator, plan: new_plan, user: create(:user, org: org)) sign_in(user) within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" end - select('html') - new_window = window_opened_by { click_button 'Download Plan' } + select("html") + new_window = window_opened_by { click_button "Download Plan" } within_window new_window do expect(page.source).to have_text(plan.title) end end - scenario 'User downloads org plan belonging to User in other org' do + scenario "User downloads org plan belonging to User in other org" do new_plan = create(:plan, :organisationally_visible, template: template) create(:role, :creator, plan: new_plan) sign_in(create(:user)) expect(page).not_to have_text(new_plan.title) end - scenario 'User attempts to download private plan belonging to User in same' do + scenario "User attempts to download private plan belonging to User in same" do new_plan = create(:plan, :privately_visible, template: template) create(:role, :creator, plan: new_plan) sign_in(create(:user)) expect(page).not_to have_text(new_plan.title) end - scenario 'User downloads their plan as HTML' do + # Separate code to test all-phase-download for html since it requires operation in new window + scenario "User downloads their plan as HTML" do within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" end - select('html') - new_window = window_opened_by { click_button 'Download Plan' } - within_window new_window do - expect(page.source).to have_text(plan.title) + select("html") + if plan.phases.present? + new_window = window_opened_by do + _select_option("phase_id", "All") + click_button "Download Plan" + end + within_window new_window do + expect(page.source).to have_text(plan.title) + plan.phases.each do |phase| + expect(page.source).to have_text(phase.title) + end + end + new_window = window_opened_by do + _select_option("phase_id", plan.phases[1].id) + click_button "Download Plan" + end + within_window new_window do + expect(page.source).to have_text(plan.title) + expect(page.source).to have_text(plan.phases[1].title) + expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 + end + else + _regular_download("html") end end - scenario 'User downloads their plan as PDF' do + scenario "User downloads their plan as PDF" do within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" + end + select("pdf") + if plan.phases.present? + _all_phase_download + _single_phase_download + else + _regular_download("pdf") end - select('pdf') - click_button 'Download Plan' - expect(page.source).to have_text(plan.title) end - scenario 'User downloads their plan as CSV' do + scenario "User downloads their plan as CSV" do within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" end - select('csv') - click_button 'Download Plan' - expect(page.source).to have_text(plan.title) + select("csv") + _regular_download("csv") end - scenario 'User downloads their plan as text' do + scenario "User downloads their plan as text" do within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" + end + select("text") + if plan.phases.present? + _all_phase_download + _single_phase_download + else + _regular_download("text") end - select('text') - click_button 'Download Plan' - expect(page.source).to have_text(plan.title) end - scenario 'User downloads their plan as docx' do + scenario "User downloads their plan as docx" do within("#plan_#{plan.id}") do - click_button('Actions') - click_link 'Download' + click_button("Actions") + click_link "Download" + end + select("docx") + if plan.phases.present? + _all_phase_download + _single_phase_download + else + _regular_download("docx") end - select('docx') - click_button 'Download Plan' + end + + # =========================== + # = Helper methods = + # =========================== + + def _regular_download(format) + if format == "html" + new_window = window_opened_by do + click_button "Download Plan" + end + within_window new_window do + expect(page.source).to have_text(plan.title) + end + else + click_button "Download Plan" + expect(page.source).to have_text(plan.title) + end + end + + def _all_phase_download + _select_option("phase_id", "All") + click_button "Download Plan" expect(page.source).to have_text(plan.title) + plan.phases.each do |phase| # All phase titles should be included in output + p phase.id + expect(page.source).to have_text(phase.title) + end end -end + + def _single_phase_download + _select_option("phase_id", plan.phases[1].id) + click_button "Download Plan" + expect(page.source).to have_text(plan.title) + expect(page.source).to have_text(plan.phases[1].title) + expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 + end + + def _select_option(select_id, option_value) + find(:id, select_id).find("option[value='#{option_value}']").select_option + end + +end \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 34cc24cd3f..5ace19dedb 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -65,4 +65,4 @@ config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view config.include Pundit::Matchers, type: :policy -end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8d1add27e0..ec34d2236a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -117,7 +117,7 @@ # Enable Capybara webmocks if we are testing a feature config.before(:each) do |example| if example.metadata[:type] == :feature - Capybara::Webmock.start + # Capybara::Webmock.start # Allow Capybara to make localhost requests and also contact the # google api chromedriver store @@ -134,4 +134,4 @@ config.after(:suite) do |example| Capybara::Webmock.stop if example.metadata[:type] == :feature end -end +end \ No newline at end of file From 0383bcb186e005c5975b0a83553c1777703f3a31 Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Mon, 3 Oct 2022 12:25:05 -0400 Subject: [PATCH 2/9] fix schema.rb back to DMPRoadmap version --- db/schema.rb | 692 +++++++++++++++++++++++++++++++------------ spec/rails_helper.rb | 2 +- spec/spec_helper.rb | 2 +- 3 files changed, 497 insertions(+), 199 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index fc2833ad17..56dbfef7d4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,102 +2,206 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# This file is the source Rails uses to define your schema when running `bin/rails -# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to -# be faster and is potentially less error prone than running all of your -# migrations from scratch. Old migrations may fail to apply correctly if those -# migrations use external dependencies or application code. +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2022_03_15_104737) do -# Could not dump table "annotations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "answers" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "annotations", id: :integer, force: :cascade do |t| + t.integer "question_id" + t.integer "org_id" + t.text "text" + t.integer "type", default: 0, null: false + t.datetime "created_at" + t.datetime "updated_at" + t.string "versionable_id", limit: 36 + t.index ["org_id"], name: "fk_rails_aca7521f72" + t.index ["question_id"], name: "index_annotations_on_question_id" + t.index ["versionable_id"], name: "index_annotations_on_versionable_id" + end - create_table "answers_options", id: false, force: :cascade do |t| - t.integer "answer_id", null: false - t.integer "option_id", null: false - t.index ["answer_id", "option_id"], name: "index_answers_options_on_answer_id_and_option_id" + create_table "answers", id: :integer, force: :cascade do |t| + t.text "text" + t.integer "plan_id" + t.integer "user_id" + t.integer "question_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "lock_version", default: 0 + t.index ["plan_id"], name: "fk_rails_84a6005a3e" + t.index ["plan_id"], name: "index_answers_on_plan_id" + t.index ["question_id"], name: "fk_rails_3d5ed4418f" + t.index ["question_id"], name: "index_answers_on_question_id" + t.index ["user_id"], name: "fk_rails_584be190c2" end create_table "answers_question_options", id: false, force: :cascade do |t| t.integer "answer_id", null: false t.integer "question_option_id", null: false t.index ["answer_id"], name: "index_answers_question_options_on_answer_id" - t.index ["question_option_id"], name: "fk_rails_01ba00b569" end -# Could not dump table "api_clients" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "api_clients", id: :integer, force: :cascade do |t| + t.string "name", null: false + t.string "description" + t.string "homepage" + t.string "contact_name" + t.string "contact_email" + t.string "client_id", null: false + t.string "client_secret", null: false + t.datetime "last_access" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "org_id" + t.text "redirect_uri" + t.string "scopes", default: "", null: false + t.boolean "confidential", default: true + t.boolean "trusted", default: false + t.integer "callback_method" + t.string "callback_uri" + t.index ["name"], name: "index_oauth_applications_on_name" + end -# Could not dump table "comments" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "conditions", id: :integer, force: :cascade do |t| + t.integer "question_id" + t.text "option_list" + t.integer "action_type" + t.integer "number" + t.text "remove_data" + t.text "webhook_data" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["question_id"], name: "index_conditions_on_question_id" + end -# Could not dump table "conditions" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "contributors", id: :integer, force: :cascade do |t| + t.string "name" + t.string "email" + t.string "phone" + t.integer "roles", null: false + t.integer "org_id" + t.integer "plan_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["email"], name: "index_contributors_on_email" + t.index ["name", "id", "org_id"], name: "index_contrib_id_and_org_id" + t.index ["org_id"], name: "index_contributors_on_org_id" + t.index ["plan_id"], name: "index_contributors_on_plan_id" + t.index ["roles"], name: "index_contributors_on_roles" + end -# Could not dump table "contributors" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "departments", id: :integer, force: :cascade do |t| + t.string "name" + t.string "code" + t.integer "org_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["org_id"], name: "index_departments_on_org_id" + end -# Could not dump table "departments" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "exported_plans", id: :integer, force: :cascade do |t| + t.integer "plan_id" + t.integer "user_id" + t.string "format" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "phase_id" + end -# Could not dump table "dmptemplate_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "external_api_access_tokens", force: :cascade do |t| + t.bigint "user_id", null: false + t.string "external_service_name", null: false + t.string "access_token", null: false + t.string "refresh_token" + t.datetime "expires_at" + t.datetime "revoked_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["expires_at"], name: "index_external_api_access_tokens_on_expires_at" + t.index ["external_service_name"], name: "index_external_api_access_tokens_on_external_service_name" + t.index ["user_id", "external_service_name"], name: "index_external_tokens_on_user_and_service" + t.index ["user_id"], name: "index_external_api_access_tokens_on_user_id" + end -# Could not dump table "dmptemplates" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "guidance_groups", id: :integer, force: :cascade do |t| + t.string "name" + t.integer "org_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "optional_subset", default: false, null: false + t.boolean "published", default: false, null: false + t.index ["org_id"], name: "index_guidance_groups_on_org_id" + end - create_table "dmptemplates_guidance_groups", id: false, force: :cascade do |t| - t.integer "dmptemplate_id" + create_table "guidances", id: :integer, force: :cascade do |t| + t.text "text" t.integer "guidance_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "published" + t.index ["guidance_group_id"], name: "index_guidances_on_guidance_group_id" end -# Could not dump table "exported_plans" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "file_types" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "file_uploads" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "friendly_id_slugs" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "guidance_groups" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - - create_table "guidance_in_group", id: false, force: :cascade do |t| - t.integer "guidance_id", null: false - t.integer "guidance_group_id", null: false - t.index ["guidance_id", "guidance_group_id"], name: "index_guidance_in_group_on_guidance_id_and_guidance_group_id" + create_table "identifier_schemes", id: :integer, force: :cascade do |t| + t.string "name" + t.string "description" + t.boolean "active" + t.datetime "created_at" + t.datetime "updated_at" + t.string "logo_url" + t.string "identifier_prefix" + t.integer "context" + t.string "external_service" end -# Could not dump table "guidance_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "guidances" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "identifier_schemes" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "identifiers" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "identifiers", id: :integer, force: :cascade do |t| + t.string "value", null: false + t.text "attrs" + t.integer "identifier_scheme_id" + t.integer "identifiable_id" + t.string "identifiable_type" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["identifiable_type", "identifiable_id"], name: "index_identifiers_on_identifiable_type_and_identifiable_id" + t.index ["identifier_scheme_id", "identifiable_id", "identifiable_type"], name: "index_identifiers_on_scheme_and_type_and_id" + t.index ["identifier_scheme_id", "value"], name: "index_identifiers_on_identifier_scheme_id_and_value" + end -# Could not dump table "languages" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "languages", id: :integer, force: :cascade do |t| + t.string "abbreviation" + t.string "description" + t.string "name" + t.boolean "default_language" + end -# Could not dump table "licenses" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "licenses", force: :cascade do |t| + t.string "name", null: false + t.string "identifier", null: false + t.string "uri", null: false + t.boolean "osi_approved", default: false + t.boolean "deprecated", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["identifier", "osi_approved", "deprecated"], name: "index_license_on_identifier_and_criteria" + t.index ["identifier"], name: "index_licenses_on_identifier" + t.index ["uri"], name: "index_licenses_on_uri" + end -# Could not dump table "metadata_standards" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "metadata_standards", force: :cascade do |t| + t.string "title" + t.text "description" + t.string "rdamsc_id" + t.string "uri" + t.json "locations" + t.json "related_entities" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end create_table "metadata_standards_research_outputs", force: :cascade do |t| t.bigint "metadata_standard_id" @@ -106,8 +210,17 @@ t.index ["research_output_id"], name: "metadata_research_outputs_on_ro" end -# Could not dump table "notes" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "notes", id: :integer, force: :cascade do |t| + t.integer "user_id" + t.text "text" + t.boolean "archived", default: false, null: false + t.integer "answer_id" + t.integer "archived_by" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["answer_id"], name: "index_notes_on_answer_id" + t.index ["user_id"], name: "fk_rails_7f2323ad43" + end create_table "notification_acknowledgements", id: :integer, force: :cascade do |t| t.integer "user_id" @@ -118,14 +231,18 @@ t.index ["user_id"], name: "index_notification_acknowledgements_on_user_id" end -# Could not dump table "notifications" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "option_warnings" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "options" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "notifications", id: :integer, force: :cascade do |t| + t.integer "notification_type" + t.string "title" + t.integer "level" + t.text "body" + t.boolean "dismissable" + t.date "starts_at" + t.date "expires_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "enabled", default: true + end create_table "org_token_permissions", id: :integer, force: :cascade do |t| t.integer "org_id" @@ -136,97 +253,179 @@ t.index ["token_permission_type_id"], name: "fk_rails_2aa265f538" end -# Could not dump table "organisation_types" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "organisations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "orgs" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "perms" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "phase_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "phases" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "orgs", id: :integer, force: :cascade do |t| + t.string "name" + t.string "abbreviation" + t.string "target_url" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "is_other", default: false, null: false + t.integer "region_id" + t.integer "language_id" + t.string "logo_uid" + t.string "logo_name" + t.string "contact_email" + t.integer "org_type", default: 0, null: false + t.text "links" + t.boolean "feedback_enabled", default: false + t.text "feedback_msg" + t.string "contact_name" + t.boolean "managed", default: false, null: false + t.string "api_create_plan_email_subject" + t.text "api_create_plan_email_body" + t.index ["language_id"], name: "fk_rails_5640112cab" + t.index ["region_id"], name: "fk_rails_5a6adf6bab" + t.string "helpdesk_email" + end - create_table "plan_sections", id: :integer, force: :cascade do |t| - t.integer "user_id" - t.integer "section_id" - t.integer "plan_id" + create_table "perms", id: :integer, force: :cascade do |t| + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.datetime "release_time" end -# Could not dump table "plans" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "phases", id: :integer, force: :cascade do |t| + t.string "title" + t.text "description" + t.integer "number" + t.integer "template_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "modifiable" + t.string "versionable_id", limit: 36 + t.index ["template_id"], name: "index_phases_on_template_id" + t.index ["versionable_id"], name: "index_phases_on_versionable_id" + end + + create_table "plans", id: :integer, force: :cascade do |t| + t.string "title" + t.integer "template_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "identifier" + t.text "description" + t.integer "visibility", default: 3, null: false + t.boolean "feedback_requested", default: false + t.boolean "complete", default: false + t.integer "org_id" + t.integer "funder_id" + t.integer "grant_id" + t.integer "api_client_id" + t.datetime "start_date" + t.datetime "end_date" + t.boolean "ethical_issues" + t.text "ethical_issues_description" + t.string "ethical_issues_report" + t.integer "funding_status" + t.bigint "research_domain_id" + t.index ["funder_id"], name: "index_plans_on_funder_id" + t.index ["grant_id"], name: "index_plans_on_grant_id" + t.index ["org_id"], name: "index_plans_on_org_id" + t.index ["research_domain_id"], name: "index_plans_on_fos_id" + t.index ["template_id"], name: "index_plans_on_template_id" + t.index ["api_client_id"], name: "index_plans_on_api_client_id" + end create_table "plans_guidance_groups", id: :integer, force: :cascade do |t| t.integer "guidance_group_id" t.integer "plan_id" t.index ["guidance_group_id", "plan_id"], name: "index_plans_guidance_groups_on_guidance_group_id_and_plan_id" + t.index ["guidance_group_id"], name: "fk_rails_ec1c5524d7" t.index ["plan_id"], name: "fk_rails_13d0671430" end -# Could not dump table "prefs" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - - create_table "project_groups", id: :integer, force: :cascade do |t| - t.boolean "project_creator" - t.boolean "project_editor" + create_table "prefs", id: :integer, force: :cascade do |t| + t.text "settings" t.integer "user_id" - t.integer "project_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "project_administrator" end - create_table "project_guidance", id: false, force: :cascade do |t| - t.integer "project_id", null: false - t.integer "guidance_group_id", null: false - t.index ["project_id", "guidance_group_id"], name: "index_project_guidance_on_project_id_and_guidance_group_id" + create_table "question_format_labels", id: false, force: :cascade do |t| + t.integer "id" + t.string "description" + t.integer "question_id" + t.integer "number" + t.datetime "created_at" + t.datetime "updated_at" end -# Could not dump table "projects" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "question_format_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "question_formats" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "question_options" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "question_formats", id: :integer, force: :cascade do |t| + t.string "title" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "option_based", default: false + t.integer "formattype", default: 0 + end -# Could not dump table "question_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "question_options", id: :integer, force: :cascade do |t| + t.integer "question_id" + t.string "text" + t.integer "number" + t.boolean "is_default" + t.datetime "created_at" + t.datetime "updated_at" + t.string "versionable_id", limit: 36 + t.index ["question_id"], name: "index_question_options_on_question_id" + t.index ["versionable_id"], name: "index_question_options_on_versionable_id" + end -# Could not dump table "questions" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "questions", id: :integer, force: :cascade do |t| + t.text "text" + t.text "default_value" + t.integer "number" + t.integer "section_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "question_format_id" + t.boolean "option_comment_display", default: true + t.boolean "modifiable" + t.string "versionable_id", limit: 36 + t.index ["question_format_id"], name: "fk_rails_4fbc38c8c7" + t.index ["section_id"], name: "index_questions_on_section_id" + t.index ["versionable_id"], name: "index_questions_on_versionable_id" + end create_table "questions_themes", id: false, force: :cascade do |t| t.integer "question_id", null: false t.integer "theme_id", null: false t.index ["question_id"], name: "index_questions_themes_on_question_id" - t.index ["theme_id"], name: "fk_rails_0489d5eeba" end - create_table "region_groups", id: :integer, force: :cascade do |t| + create_table "regions", id: :integer, force: :cascade do |t| + t.string "abbreviation" + t.string "description" + t.string "name" t.integer "super_region_id" - t.integer "region_id" end -# Could not dump table "regions" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "related_identifiers", force: :cascade do |t| + t.bigint "identifier_scheme_id" + t.integer "identifier_type", null: false + t.integer "relation_type", null: false + t.bigint "identifiable_id" + t.string "identifiable_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "value", null: false + t.index ["identifiable_id", "identifiable_type", "relation_type"], name: "index_relateds_on_identifiable_and_relation_type" + t.index ["identifier_scheme_id"], name: "index_related_identifiers_on_identifier_scheme_id" + t.index ["identifier_type"], name: "index_related_identifiers_on_identifier_type" + t.index ["relation_type"], name: "index_related_identifiers_on_relation_type" + end -# Could not dump table "repositories" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "repositories", force: :cascade do |t| + t.string "name", null: false + t.text "description", null: false + t.string "homepage" + t.string "contact" + t.string "uri", null: false + t.json "info" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["homepage"], name: "index_repositories_on_homepage" + t.index ["name"], name: "index_repositories_on_name" + t.index ["uri"], name: "index_repositories_on_uri" + end create_table "repositories_research_outputs", force: :cascade do |t| t.bigint "research_output_id" @@ -235,11 +434,36 @@ t.index ["research_output_id"], name: "index_repositories_research_outputs_on_research_output_id" end -# Could not dump table "research_domains" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "research_domains", force: :cascade do |t| + t.string "identifier", null: false + t.string "label", null: false + t.bigint "parent_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["parent_id"], name: "index_research_domains_on_parent_id" + end -# Could not dump table "research_outputs" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "research_outputs", force: :cascade do |t| + t.integer "plan_id" + t.integer "output_type", default: 3, null: false + t.string "output_type_description" + t.string "title", null: false + t.string "abbreviation" + t.integer "display_order" + t.boolean "is_default" + t.text "description" + t.integer "access", default: 0, null: false + t.datetime "release_date" + t.boolean "personal_data" + t.boolean "sensitive_data" + t.bigint "byte_size" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "license_id" + t.index ["license_id"], name: "index_research_outputs_on_license_id" + t.index ["output_type"], name: "index_research_outputs_on_output_type" + t.index ["plan_id"], name: "index_research_outputs_on_plan_id" + end create_table "roles", id: :integer, force: :cascade do |t| t.integer "user_id" @@ -252,35 +476,89 @@ t.index ["user_id"], name: "index_roles_on_user_id" end -# Could not dump table "section_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "sections" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "sessions" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "settings" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "sections", id: :integer, force: :cascade do |t| + t.string "title" + t.text "description" + t.integer "number" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "phase_id" + t.boolean "modifiable" + t.string "versionable_id", limit: 36 + t.index ["phase_id"], name: "index_sections_on_phase_id" + t.index ["versionable_id"], name: "index_sections_on_versionable_id" + end -# Could not dump table "splash_logs" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "sessions", id: :integer, force: :cascade do |t| + t.string "session_id", limit: 64, null: false + t.text "data" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["session_id"], name: "index_sessions_on_session_id", unique: true + t.index ["updated_at"], name: "index_sessions_on_updated_at" + end -# Could not dump table "stats" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "settings", id: :integer, force: :cascade do |t| + t.string "var" + t.text "value" + t.integer "target_id", null: false + t.string "target_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end -# Could not dump table "stylesheets" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "stats", id: :integer, force: :cascade do |t| + t.bigint "count", default: 0 + t.date "date", null: false + t.string "type", null: false + t.integer "org_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "details" + t.boolean "filtered", default: false + end -# Could not dump table "suggested_answers" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "subscriptions", force: :cascade do |t| + t.bigint "plan_id" + t.integer "subscription_types", null: false + t.string "callback_uri" + t.bigint "subscriber_id" + t.string "subscriber_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "last_notified" + t.index ["plan_id"], name: "index_subscriptions_on_plan_id" + t.index ["subscriber_id", "subscriber_type", "plan_id"], name: "index_subscribers_on_identifiable_and_plan_id" + end -# Could not dump table "templates" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "templates", id: :integer, force: :cascade do |t| + t.string "title" + t.text "description" + t.boolean "published" + t.integer "org_id" + t.string "locale" + t.boolean "is_default" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "version" + t.integer "visibility" + t.integer "customization_of" + t.integer "family_id" + t.boolean "archived" + t.text "links" + t.index ["family_id", "version"], name: "index_templates_on_family_id_and_version", unique: true + t.index ["family_id"], name: "index_templates_on_family_id" + t.index ["org_id", "family_id"], name: "template_organisation_dmptemplate_index" + t.index ["org_id"], name: "index_templates_on_org_id" + end -# Could not dump table "themes" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "themes", id: :integer, force: :cascade do |t| + t.string "title" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "locale" + end create_table "themes_in_guidance", id: false, force: :cascade do |t| t.integer "theme_id" @@ -289,23 +567,61 @@ t.index ["theme_id"], name: "index_themes_in_guidance_on_theme_id" end -# Could not dump table "token_permission_types" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "trackers" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "user_role_types" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "user_statuses" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "token_permission_types", id: :integer, force: :cascade do |t| + t.string "token_type" + t.text "text_description" + t.datetime "created_at" + t.datetime "updated_at" + end -# Could not dump table "user_types" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "trackers", id: :integer, force: :cascade do |t| + t.integer "org_id" + t.string "code" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["org_id"], name: "index_trackers_on_org_id" + end -# Could not dump table "users" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 + create_table "users", id: :integer, force: :cascade do |t| + t.string "firstname" + t.string "surname" + t.string "email", limit: 80, default: "", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "encrypted_password" + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "invitation_token" + t.datetime "invitation_created_at" + t.datetime "invitation_sent_at" + t.datetime "invitation_accepted_at" + t.string "other_organisation" + t.boolean "accept_terms" + t.integer "org_id" + t.string "api_token" + t.integer "invited_by_id" + t.string "invited_by_type" + t.integer "language_id" + t.string "recovery_email" + t.string "ldap_password" + t.string "ldap_username" + t.boolean "active", default: true + t.integer "department_id" + t.datetime "last_api_access" + t.index ["department_id"], name: "fk_rails_f29bf9cdf2" + t.index ["email"], name: "index_users_on_email" + t.index ["language_id"], name: "fk_rails_45f4f12508" + t.index ["org_id"], name: "index_users_on_org_id" + end create_table "users_perms", id: false, force: :cascade do |t| t.integer "user_id" @@ -314,25 +630,11 @@ t.index ["user_id"], name: "index_users_perms_on_user_id" end - create_table "users_roles", id: false, force: :cascade do |t| - t.integer "user_id" - t.integer "role_id" - t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id" - end - -# Could not dump table "version_translations" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - -# Could not dump table "versions" because of following ActiveRecord::StatementInvalid -# Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 - add_foreign_key "annotations", "orgs" add_foreign_key "annotations", "questions" add_foreign_key "answers", "plans" add_foreign_key "answers", "questions" add_foreign_key "answers", "users" - add_foreign_key "answers_question_options", "answers" - add_foreign_key "answers_question_options", "question_options" add_foreign_key "conditions", "questions" add_foreign_key "guidance_groups", "orgs" add_foreign_key "guidances", "guidance_groups" @@ -352,8 +654,6 @@ add_foreign_key "question_options", "questions" add_foreign_key "questions", "question_formats" add_foreign_key "questions", "sections" - add_foreign_key "questions_themes", "questions" - add_foreign_key "questions_themes", "themes" add_foreign_key "research_domains", "research_domains", column: "parent_id" add_foreign_key "research_outputs", "licenses" add_foreign_key "roles", "plans" @@ -366,6 +666,4 @@ add_foreign_key "users", "departments" add_foreign_key "users", "languages" add_foreign_key "users", "orgs" - add_foreign_key "users_perms", "perms" - add_foreign_key "users_perms", "users" end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 5ace19dedb..34cc24cd3f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -65,4 +65,4 @@ config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view config.include Pundit::Matchers, type: :policy -end \ No newline at end of file +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ec34d2236a..bda162c5c8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -134,4 +134,4 @@ config.after(:suite) do |example| Capybara::Webmock.stop if example.metadata[:type] == :feature end -end \ No newline at end of file +end From d8f10606df65bd9e556e8b4d9afb85780e1c1438 Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Mon, 3 Oct 2022 12:31:34 -0400 Subject: [PATCH 3/9] fix rubocup issue --- app/controllers/plan_exports_controller.rb | 8 +- app/controllers/plans_controller.rb | 6 +- spec/features/plans/exports_spec.rb | 106 ++++++++++----------- 3 files changed, 58 insertions(+), 62 deletions(-) diff --git a/app/controllers/plan_exports_controller.rb b/app/controllers/plan_exports_controller.rb index 235460b7f4..a0f8a362e2 100644 --- a/app/controllers/plan_exports_controller.rb +++ b/app/controllers/plan_exports_controller.rb @@ -38,15 +38,15 @@ def show @formatting = export_params[:formatting] || @plan.settings(:export).formatting if params.key?(:phase_id) # order phases by phase number asc - @hash[:phases] = @hash[:phases].sort_by{|phase| phase[:number]} - if (params[:phase_id] == "All") + @hash[:phases] = @hash[:phases].sort_by { |phase| phase[:number] } + if params[:phase_id] == 'All' @hash[:all_phases] = true else @selected_phase = @plan.phases.find(params[:phase_id]) end else - @plan.phases.order("phases.updated_at DESC") - .detect { |p| p.visibility_allowed?(@plan) } + @plan.phases.order('phases.updated_at DESC') + .detect { |p| p.visibility_allowed?(@plan) } end # Added contributors to coverage of plans. diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 5d611d0e20..3f09ad0e34 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -376,11 +376,9 @@ def download @plan = Plan.find(params[:id]) authorize @plan @phase_options = @plan.phases.order(:number).pluck(:title, :id) - if @phase_options.length > 1 - @phase_options.insert(0,["All phases", "All"]) - end + @phase_options.insert(0, ['All phases', 'All']) if @phase_options.length > 1 @export_settings = @plan.settings(:export) - render "download" + render 'download' end # POST /plans/:id/duplicate diff --git a/spec/features/plans/exports_spec.rb b/spec/features/plans/exports_spec.rb index 85cd14a8d7..fe6bf244a1 100644 --- a/spec/features/plans/exports_spec.rb +++ b/spec/features/plans/exports_spec.rb @@ -1,9 +1,8 @@ # frozen_string_literal: true -require "rails_helper" - -RSpec.describe "PlansExports", type: :feature, js: true do +require 'rails_helper' +RSpec.describe 'PlansExports', type: :feature, js: true do let!(:template) { create(:template, phases: 2) } let!(:org) { create(:org, managed: true, is_other: false) } let!(:user) { create(:user, org: org) } @@ -17,7 +16,7 @@ sign_in(user) end - scenario "User downloads plan from organisational plans portion of the dashboard" do + scenario 'User downloads plan from organisational plans portion of the dashboard' do new_plan = create(:plan, :publicly_visible, template: template) new_phase = create(:phase, template: template, sections: 2) new_phase.sections do |sect| @@ -35,44 +34,44 @@ find(:css, "a[href*=\"/#{new_plan.id}/export.pdf\"]", visible: false).click end - scenario "User downloads public plan belonging to other User" do + scenario 'User downloads public plan belonging to other User' do new_plan = create(:plan, :publicly_visible, template: template) create(:role, :creator, plan: new_plan) sign_in(user) within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("html") - new_window = window_opened_by { click_button "Download Plan" } + select('html') + new_window = window_opened_by { click_button 'Download Plan' } within_window new_window do expect(page.source).to have_text(plan.title) end end - scenario "User downloads org plan belonging to User in same org" do + scenario 'User downloads org plan belonging to User in same org' do new_plan = create(:plan, :organisationally_visible, template: template) create(:role, :creator, plan: new_plan, user: create(:user, org: org)) sign_in(user) within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("html") - new_window = window_opened_by { click_button "Download Plan" } + select('html') + new_window = window_opened_by { click_button 'Download Plan' } within_window new_window do expect(page.source).to have_text(plan.title) end end - scenario "User downloads org plan belonging to User in other org" do + scenario 'User downloads org plan belonging to User in other org' do new_plan = create(:plan, :organisationally_visible, template: template) create(:role, :creator, plan: new_plan) sign_in(create(:user)) expect(page).not_to have_text(new_plan.title) end - scenario "User attempts to download private plan belonging to User in same" do + scenario 'User attempts to download private plan belonging to User in same' do new_plan = create(:plan, :privately_visible, template: template) create(:role, :creator, plan: new_plan) sign_in(create(:user)) @@ -80,16 +79,16 @@ end # Separate code to test all-phase-download for html since it requires operation in new window - scenario "User downloads their plan as HTML" do + scenario 'User downloads their plan as HTML' do within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("html") + select('html') if plan.phases.present? new_window = window_opened_by do - _select_option("phase_id", "All") - click_button "Download Plan" + _select_option('phase_id', 'All') + click_button 'Download Plan' end within_window new_window do expect(page.source).to have_text(plan.title) @@ -98,8 +97,8 @@ end end new_window = window_opened_by do - _select_option("phase_id", plan.phases[1].id) - click_button "Download Plan" + _select_option('phase_id', plan.phases[1].id) + click_button 'Download Plan' end within_window new_window do expect(page.source).to have_text(plan.title) @@ -107,58 +106,58 @@ expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 end else - _regular_download("html") + _regular_download('html') end end - scenario "User downloads their plan as PDF" do + scenario 'User downloads their plan as PDF' do within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("pdf") + select('pdf') if plan.phases.present? _all_phase_download _single_phase_download else - _regular_download("pdf") + _regular_download('pdf') end end - scenario "User downloads their plan as CSV" do + scenario 'User downloads their plan as CSV' do within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("csv") - _regular_download("csv") + select('csv') + _regular_download('csv') end - scenario "User downloads their plan as text" do + scenario 'User downloads their plan as text' do within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("text") + select('text') if plan.phases.present? _all_phase_download _single_phase_download else - _regular_download("text") + _regular_download('text') end end - scenario "User downloads their plan as docx" do + scenario 'User downloads their plan as docx' do within("#plan_#{plan.id}") do - click_button("Actions") - click_link "Download" + click_button('Actions') + click_link 'Download' end - select("docx") + select('docx') if plan.phases.present? _all_phase_download _single_phase_download else - _regular_download("docx") + _regular_download('docx') end end @@ -167,22 +166,22 @@ # =========================== def _regular_download(format) - if format == "html" + if format == 'html' new_window = window_opened_by do - click_button "Download Plan" + click_button 'Download Plan' end within_window new_window do expect(page.source).to have_text(plan.title) end else - click_button "Download Plan" + click_button 'Download Plan' expect(page.source).to have_text(plan.title) end end def _all_phase_download - _select_option("phase_id", "All") - click_button "Download Plan" + _select_option('phase_id', 'All') + click_button 'Download Plan' expect(page.source).to have_text(plan.title) plan.phases.each do |phase| # All phase titles should be included in output p phase.id @@ -191,8 +190,8 @@ def _all_phase_download end def _single_phase_download - _select_option("phase_id", plan.phases[1].id) - click_button "Download Plan" + _select_option('phase_id', plan.phases[1].id) + click_button 'Download Plan' expect(page.source).to have_text(plan.title) expect(page.source).to have_text(plan.phases[1].title) expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 @@ -201,5 +200,4 @@ def _single_phase_download def _select_option(select_id, option_value) find(:id, select_id).find("option[value='#{option_value}']").select_option end - -end \ No newline at end of file +end From a5c2e9cc5cfc68ae5eb7efb2f5a05b3680a33f8c Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Mon, 3 Oct 2022 13:00:22 -0400 Subject: [PATCH 4/9] add rubocup exception --- spec/features/plans/exports_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/features/plans/exports_spec.rb b/spec/features/plans/exports_spec.rb index fe6bf244a1..38081afb3f 100644 --- a/spec/features/plans/exports_spec.rb +++ b/spec/features/plans/exports_spec.rb @@ -165,6 +165,8 @@ # = Helper methods = # =========================== + # rubocop:disable Metrics/AbcSize + # disable Rubocup metrics check to confirm both plan title and phase title on downloaded file def _regular_download(format) if format == 'html' new_window = window_opened_by do @@ -184,7 +186,6 @@ def _all_phase_download click_button 'Download Plan' expect(page.source).to have_text(plan.title) plan.phases.each do |phase| # All phase titles should be included in output - p phase.id expect(page.source).to have_text(phase.title) end end @@ -197,6 +198,7 @@ def _single_phase_download expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2 end + # rubocop:enable Metrics/AbcSize def _select_option(select_id, option_value) find(:id, select_id).find("option[value='#{option_value}']").select_option end From e7a9b65c70ed84e2292e7f24556e22d19c0c3b4c Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Wed, 5 Oct 2022 13:40:51 -0400 Subject: [PATCH 5/9] add missing translation and adjust variables --- app/controllers/plan_exports_controller.rb | 8 ++++---- db/schema.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/plan_exports_controller.rb b/app/controllers/plan_exports_controller.rb index a0f8a362e2..2c692e9916 100644 --- a/app/controllers/plan_exports_controller.rb +++ b/app/controllers/plan_exports_controller.rb @@ -36,7 +36,7 @@ def show @hash = @plan.as_pdf(current_user, @show_coversheet) @formatting = export_params[:formatting] || @plan.settings(:export).formatting - if params.key?(:phase_id) + if params.key?(:phase_id) && params[:phase_id].length.positive? # order phases by phase number asc @hash[:phases] = @hash[:phases].sort_by { |phase| phase[:number] } if params[:phase_id] == 'All' @@ -45,8 +45,8 @@ def show @selected_phase = @plan.phases.find(params[:phase_id]) end else - @plan.phases.order('phases.updated_at DESC') - .detect { |p| p.visibility_allowed?(@plan) } + @selected_phase = @plan.phases.order('phases.updated_at DESC') + .detect { |p| p.visibility_allowed?(@plan) } end # Added contributors to coverage of plans. @@ -107,7 +107,7 @@ def show_pdf date: l(@plan.updated_at.to_date, format: :readable)), font_size: 8, spacing: (Integer(@formatting[:margin][:bottom]) / 2) - 4, - right: '[page] of [topage]', + right: _('[page] of [topage]'), encoding: 'utf8' } end diff --git a/db/schema.rb b/db/schema.rb index 56dbfef7d4..ae11e2f118 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -666,4 +666,4 @@ add_foreign_key "users", "departments" add_foreign_key "users", "languages" add_foreign_key "users", "orgs" -end +end \ No newline at end of file From ed12c2ecbbf45b1c102de26492cc02367688818e Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Tue, 21 Feb 2023 14:46:42 -0500 Subject: [PATCH 6/9] merge development --- Gemfile.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 575e507936..993eeec238 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -268,6 +268,8 @@ GEM mysql2 (0.5.4) nenv (0.3.0) nio4r (2.5.8) + nokogiri (1.13.9-arm64-darwin) + racc (~> 1.4) nokogiri (1.13.9-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) @@ -498,6 +500,7 @@ GEM zeitwerk (2.6.1) PLATFORMS + arm64-darwin-22 x86_64-linux DEPENDENCIES @@ -580,4 +583,4 @@ RUBY VERSION ruby 2.7.6p219 BUNDLED WITH - 2.3.15 + 2.3.25 From 8ef22ee749b40f30de2bb5a926cf049028882423 Mon Sep 17 00:00:00 2001 From: pengyin-shan Date: Mon, 27 Feb 2023 15:09:40 -0500 Subject: [PATCH 7/9] Update changelog and github actions to use node 16 only --- .github/workflows/eslint.yml | 1 + .github/workflows/mysql.yml | 1 + .github/workflows/postgres.yml | 1 + CHANGELOG.md | 2 ++ 4 files changed, 5 insertions(+) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index ac13cdc40a..1910be2d94 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -15,6 +15,7 @@ jobs: - uses: actions/setup-node@v2 with: cache: 'yarn' + node-version: 16 # Run yarn install for JS dependencies - name: 'Yarn Install' diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index 722690cc6c..3305b14109 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -26,6 +26,7 @@ jobs: - uses: actions/setup-node@v2 with: cache: 'yarn' + node-version: 16 # Copy all of the example configs over - name: 'Setup the application' diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 1a866315b3..166951069e 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -42,6 +42,7 @@ jobs: - uses: actions/setup-node@v2 with: cache: 'yarn' + node-version: 16 # Install the Postgres developer packages - name: 'Install Postgresql Packages' diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c5a065ac8..7f30d56577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - Added CHANGELOG.md and Danger Github Action [#3257](https://github.com/DMPRoadmap/roadmap/issues/3257) - Added validation with custom error message in research_output.rb to ensure a user does not enter a very large value as 'Anticipated file size'. [#3161](https://github.com/DMPRoadmap/roadmap/issues/3161) - Added popover for org profile page and added explanation for public plan +- Allow users to download both single phase and in PDF, TEXT and DOCX format. CSV file can only download single phase instead of all phases. + ### Fixed - Froze mail gem version [#3254](https://github.com/DMPRoadmap/roadmap/issues/3254) From ae0aec92711ab3ed38e8daa2df116196bbfda71d Mon Sep 17 00:00:00 2001 From: briri Date: Thu, 23 Mar 2023 12:12:37 -0700 Subject: [PATCH 8/9] Add Gemfile.lock change --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 770e12d7b7..56af38fc36 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -538,7 +538,7 @@ GEM zeitwerk (2.6.6) PLATFORMS - arm64-darwin-22 + arm64-darwin-21 arm64-darwin-22 x86_64-linux @@ -624,4 +624,4 @@ RUBY VERSION ruby 2.7.6p219 BUNDLED WITH - 2.4.3 + 2.4.8 From 1b849cc99fb0c2811a1d7a3c76b6859a66d04c04 Mon Sep 17 00:00:00 2001 From: briri Date: Thu, 23 Mar 2023 12:36:29 -0700 Subject: [PATCH 9/9] added x86_64 to bundle --- Gemfile.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile.lock b/Gemfile.lock index 179e43917c..e4093c8147 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -522,6 +522,7 @@ GEM PLATFORMS arm64-darwin-21 + x86_64-linux DEPENDENCIES activerecord_json_validator