diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 8b2671b44..939a7c4aa 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -1,4 +1,4 @@ -require 'database_cleaner' +require "database_cleaner" DatabaseCleaner.clean_with :truncation @logger = Logger.new(STDOUT) @logger.formatter = proc do |_severity, _datetime, _progname, msg| @@ -8,7 +8,7 @@ DatabaseCleaner.clean_with :truncation def section(section_title) @logger.info section_title yield - log(' ✅') + log(" ✅") end def log(msg) @@ -19,27 +19,27 @@ def random_locales [I18n.default_locale, *I18n.available_locales.sample(4)].uniq end -require_relative 'dev_seeds/settings' -require_relative 'dev_seeds/geozones' -require_relative 'dev_seeds/users' -require_relative 'dev_seeds/tags_categories' -require_relative 'dev_seeds/debates' -require_relative 'dev_seeds/proposals' -require_relative 'dev_seeds/budgets' -require_relative 'dev_seeds/spending_proposals' -require_relative 'dev_seeds/comments' -require_relative 'dev_seeds/votes' -require_relative 'dev_seeds/flags' -require_relative 'dev_seeds/hiddings' -require_relative 'dev_seeds/banners' -require_relative 'dev_seeds/polls' -require_relative 'dev_seeds/communities' -require_relative 'dev_seeds/legislation_processes' -require_relative 'dev_seeds/newsletters' -require_relative 'dev_seeds/notifications' -require_relative 'dev_seeds/widgets' -require_relative 'dev_seeds/admin_notifications' -require_relative 'dev_seeds/legislation_proposals' -require_relative 'dev_seeds/milestones' +require_relative "dev_seeds/settings" +require_relative "dev_seeds/geozones" +require_relative "dev_seeds/users" +require_relative "dev_seeds/tags_categories" +require_relative "dev_seeds/debates" +require_relative "dev_seeds/proposals" +require_relative "dev_seeds/budgets" +require_relative "dev_seeds/spending_proposals" +require_relative "dev_seeds/comments" +require_relative "dev_seeds/votes" +require_relative "dev_seeds/flags" +require_relative "dev_seeds/hiddings" +require_relative "dev_seeds/banners" +require_relative "dev_seeds/polls" +require_relative "dev_seeds/communities" +require_relative "dev_seeds/legislation_processes" +require_relative "dev_seeds/newsletters" +require_relative "dev_seeds/notifications" +require_relative "dev_seeds/widgets" +require_relative "dev_seeds/admin_notifications" +require_relative "dev_seeds/legislation_proposals" +require_relative "dev_seeds/milestones" log "All dev seeds created successfuly 👍" diff --git a/db/dev_seeds/admin_notifications.rb b/db/dev_seeds/admin_notifications.rb index 799fdf04c..308928d53 100644 --- a/db/dev_seeds/admin_notifications.rb +++ b/db/dev_seeds/admin_notifications.rb @@ -1,44 +1,47 @@ section "Creating Admin Notifications & Templates" do AdminNotification.create!( - title_en: 'Do you have a proposal?', - title_es: 'Tienes una propuesta?', + title_en: "Do you have a proposal?", + title_es: "Tienes una propuesta?", - body_en: 'Remember you can create a proposal with your ideas and people will discuss & support it.', - body_es: 'Recuerda que puedes crear propuestas y los ciudadanos las debatirán y apoyarán.', + body_en: "Remember you can create a proposal with your ideas and "\ + "people will discuss & support it.", + body_es: "Recuerda que puedes crear propuestas y los ciudadanos las debatirán y apoyarán.", - link: Setting['url'] + '/proposals', - segment_recipient: 'administrators' + link: Setting["url"] + "/proposals", + segment_recipient: "administrators" ).deliver AdminNotification.create!( - title_en: 'Help us translate consul', - title_es: 'Ayúdanos a traducir CONSUL', + title_en: "Help us translate consul", + title_es: "Ayúdanos a traducir CONSUL", - body_en: 'If you are proficient in a language, please help us translate consul!.', - body_es: 'Si dominas un idioma, ayúdanos a completar su traducción en CONSUL.', + body_en: "If you are proficient in a language, please help us translate consul!.", + body_es: "Si dominas un idioma, ayúdanos a completar su traducción en CONSUL.", - link: 'https://crwd.in/consul', - segment_recipient: 'administrators' + link: "https://crwd.in/consul", + segment_recipient: "administrators" ).deliver AdminNotification.create!( - title_en: 'You can now geolocate proposals & investments', - title_es: 'Ahora puedes geolocalizar propuestas y proyectos de inversión', + title_en: "You can now geolocate proposals & investments", + title_es: "Ahora puedes geolocalizar propuestas y proyectos de inversión", - body_en: 'When you create a proposal or investment you now can specify a point on a map', - body_es: 'Cuando crees una propuesta o proyecto de inversión podrás especificar su localización en el mapa', + body_en: "When you create a proposal or investment you now can specify a point on a map", + body_es: "Cuando crees una propuesta o proyecto de inversión podrás especificar "\ + "su localización en el mapa", - segment_recipient: 'administrators' + segment_recipient: "administrators" ).deliver AdminNotification.create!( - title_en: 'We are closing the Participatory Budget!!', - title_es: 'Últimos días para crear proyectos de Presupuestos Participativos', + title_en: "We are closing the Participatory Budget!!", + title_es: "Últimos días para crear proyectos de Presupuestos Participativos", - body_en: 'Hurry up and create a last proposal before it ends next in few days!', - body_es: 'Quedan pocos dias para que se cierre el plazo de presentación de proyectos de inversión para los presupuestos participativos!', + body_en: "Hurry up and create a last proposal before it ends next in few days!", + body_es: "Quedan pocos dias para que se cierre el plazo de presentación de proyectos de "\ + "inversión para los presupuestos participativos!", - segment_recipient: 'administrators', + segment_recipient: "administrators", sent_at: nil ) end diff --git a/db/dev_seeds/banners.rb b/db/dev_seeds/banners.rb index 641f51994..90f435978 100644 --- a/db/dev_seeds/banners.rb +++ b/db/dev_seeds/banners.rb @@ -1,7 +1,7 @@ section "Creating banners" do Proposal.last(3).each do |proposal| - title = Faker::Lorem.sentence(word_count = 3) - description = Faker::Lorem.sentence(word_count = 12) + title = Faker::Lorem.sentence(3) + description = Faker::Lorem.sentence(12) target_url = Rails.application.routes.url_helpers.proposal_path(proposal) banner = Banner.new(title: title, description: description, @@ -20,9 +20,9 @@ section "Creating banners" do end section "Creating web sections" do - WebSection.create(name: 'homepage') - WebSection.create(name: 'debates') - WebSection.create(name: 'proposals') - WebSection.create(name: 'budgets') - WebSection.create(name: 'help_page') + WebSection.create(name: "homepage") + WebSection.create(name: "debates") + WebSection.create(name: "proposals") + WebSection.create(name: "budgets") + WebSection.create(name: "help_page") end diff --git a/db/dev_seeds/budgets.rb b/db/dev_seeds/budgets.rb index cb763c294..f0f842d73 100644 --- a/db/dev_seeds/budgets.rb +++ b/db/dev_seeds/budgets.rb @@ -1,11 +1,11 @@ -INVESTMENT_IMAGE_FILES = %w{ +INVESTMENT_IMAGE_FILES = %w[ brennan-ehrhardt-25066-unsplash_713x513.jpg carl-nenzen-loven-381554-unsplash_713x475.jpg carlos-zurita-215387-unsplash_713x475.jpg hector-arguello-canals-79584-unsplash_713x475.jpg olesya-grichina-218176-unsplash_713x475.jpg sole-d-alessandro-340443-unsplash_713x475.jpg -}.map do |filename| +].map do |filename| File.new(Rails.root.join("db", "dev_seeds", "images", @@ -129,10 +129,10 @@ section "Creating Investments" do title: Faker::Lorem.sentence(3).truncate(60), description: "

#{Faker::Lorem.paragraphs.join('

')}

", created_at: rand((Time.current - 1.week)..Time.current), - feasibility: %w{undecided unfeasible feasible feasible feasible feasible}.sample, + feasibility: %w[undecided unfeasible feasible feasible feasible feasible].sample, unfeasibility_explanation: Faker::Lorem.paragraph, valuation_finished: [false, true].sample, - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), price: rand(1..100) * 100000, skip_map: "1", terms_of_service: "1" @@ -151,9 +151,9 @@ end section "Geolocating Investments" do Budget.find_each do |budget| budget.investments.each do |investment| - MapLocation.create(latitude: Setting['map_latitude'].to_f + rand(-10..10)/100.to_f, - longitude: Setting['map_longitude'].to_f + rand(-10..10)/100.to_f, - zoom: Setting['map_zoom'], + MapLocation.create(latitude: Setting["map_latitude"].to_f + rand(-10..10)/100.to_f, + longitude: Setting["map_longitude"].to_f + rand(-10..10)/100.to_f, + zoom: Setting["map_zoom"], investment_id: investment.id) end end @@ -175,7 +175,7 @@ section "Winner Investments" do group: heading.group, budget: heading.group.budget, title: Faker::Lorem.sentence(3).truncate(60), - description: "

#{Faker::Lorem.paragraphs.join('

')}

", + description: "

#{Faker::Lorem.paragraphs.join("

")}

", created_at: rand((Time.current - 1.week)..Time.current), feasibility: "feasible", valuation_finished: true, diff --git a/db/dev_seeds/comments.rb b/db/dev_seeds/comments.rb index 79b3b871d..03bb9bbe0 100644 --- a/db/dev_seeds/comments.rb +++ b/db/dev_seeds/comments.rb @@ -1,5 +1,5 @@ section "Commenting Investments, Debates & Proposals" do - %w(Budget::Investment Debate Proposal).each do |commentable_class| + %w[Budget::Investment Debate Proposal].each do |commentable_class| 100.times do commentable = commentable_class.constantize.all.sample Comment.create!(user: User.all.sample, diff --git a/db/dev_seeds/debates.rb b/db/dev_seeds/debates.rb index e53992782..009e28a72 100644 --- a/db/dev_seeds/debates.rb +++ b/db/dev_seeds/debates.rb @@ -3,25 +3,25 @@ section "Creating Debates" do 30.times do author = User.all.sample description = "

#{Faker::Lorem.paragraphs.join('

')}

" - debate = Debate.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - created_at: rand((Time.current - 1.week)..Time.current), - description: description, - tag_list: tags.sample(3).join(','), - geozone: Geozone.all.sample, - terms_of_service: "1") + Debate.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + created_at: rand((Time.current - 1.week)..Time.current), + description: description, + tag_list: tags.sample(3).join(","), + geozone: Geozone.all.sample, + terms_of_service: "1") end - tags = ActsAsTaggableOn::Tag.where(kind: 'category') + tags = ActsAsTaggableOn::Tag.where(kind: "category") 30.times do author = User.all.sample description = "

#{Faker::Lorem.paragraphs.join('

')}

" - debate = Debate.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - created_at: rand((Time.current - 1.week)..Time.current), - description: description, - tag_list: tags.sample(3).join(','), - geozone: Geozone.all.sample, - terms_of_service: "1") + Debate.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + created_at: rand((Time.current - 1.week)..Time.current), + description: description, + tag_list: tags.sample(3).join(","), + geozone: Geozone.all.sample, + terms_of_service: "1") end end diff --git a/db/dev_seeds/geozones.rb b/db/dev_seeds/geozones.rb index 029d936a9..d0d342f57 100644 --- a/db/dev_seeds/geozones.rb +++ b/db/dev_seeds/geozones.rb @@ -1,22 +1,22 @@ section "Creating Geozones" do - Geozone.create(name: I18n.t('seeds.geozones.north_district'), + Geozone.create(name: I18n.t("seeds.geozones.north_district"), external_code: "001", census_code: "01", html_map_coordinates: "30,139,45,153,77,148,107,165,138,201,146,218,186,198,216,"\ "196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320,"\ "66,286,73,258,65,265,57,249,47,207,58,159,84,108,85,72,101,51,114") - Geozone.create(name: I18n.t('seeds.geozones.west_district'), + Geozone.create(name: I18n.t("seeds.geozones.west_district"), external_code: "002", census_code: "02", html_map_coordinates: "42,153,31,176,24,202,20,221,44,235,59,249,55,320,30,354,"\ "31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228,"\ "327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140,"\ "268,138,246,135,236,139,222,151,214,136,197,120,179,99,159,85,149,65,149,56,149") - Geozone.create(name: I18n.t('seeds.geozones.east_district'), + Geozone.create(name: I18n.t("seeds.geozones.east_district"), external_code: "003", census_code: "03", html_map_coordinates: "175,353,162,378,161,407,153,416,167,432,184,447,225,426,"\ "250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188,"\ "281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277,"\ "267,294,249,312,219,333,198,346,184,353") - Geozone.create(name: I18n.t('seeds.geozones.central_district'), + Geozone.create(name: I18n.t("seeds.geozones.central_district"), external_code: "004", census_code: "04", html_map_coordinates: "152,308,137,258,133,235,147,216,152,214,186,194,210,196,"\ "228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296,"\ diff --git a/db/dev_seeds/legislation_proposals.rb b/db/dev_seeds/legislation_proposals.rb index e309dd28c..def1b6535 100644 --- a/db/dev_seeds/legislation_proposals.rb +++ b/db/dev_seeds/legislation_proposals.rb @@ -6,7 +6,7 @@ section "Creating legislation proposals" do summary: Faker::Lorem.paragraph, author: User.all.sample, process: Legislation::Process.all.sample, - terms_of_service: '1', + terms_of_service: "1", selected: rand <= 1.0 / 3) end end diff --git a/db/dev_seeds/milestones.rb b/db/dev_seeds/milestones.rb index 54ed1e997..42b0df0b7 100644 --- a/db/dev_seeds/milestones.rb +++ b/db/dev_seeds/milestones.rb @@ -1,8 +1,8 @@ section "Creating default Milestone Statuses" do - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.studying_project')) - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.bidding')) - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executing_project')) - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executed')) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.studying_project")) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.bidding")) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.executing_project")) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.executed")) end section "Creating investment milestones" do diff --git a/db/dev_seeds/newsletters.rb b/db/dev_seeds/newsletters.rb index 08eda5301..02f93d1be 100644 --- a/db/dev_seeds/newsletters.rb +++ b/db/dev_seeds/newsletters.rb @@ -15,7 +15,7 @@ section "Creating Newsletters" do Newsletter.create!( subject: "Newsletter subject #{n}", segment_recipient: UserSegments::SEGMENTS.sample, - from: 'no-reply@consul.dev', + from: "no-reply@consul.dev", body: newsletter_body.sample, sent_at: [Time.now, nil].sample ) diff --git a/db/dev_seeds/notifications.rb b/db/dev_seeds/notifications.rb index 3d7282f4a..e74e9d7e3 100644 --- a/db/dev_seeds/notifications.rb +++ b/db/dev_seeds/notifications.rb @@ -3,7 +3,7 @@ section "Creating comment notifications" do debate = Debate.create!(author: user, title: Faker::Lorem.sentence(3).truncate(60), description: "

#{Faker::Lorem.paragraphs.join('

')}

", - tag_list: ActsAsTaggableOn::Tag.all.sample(3).join(','), + tag_list: ActsAsTaggableOn::Tag.all.sample(3).join(","), geozone: Geozone.reorder("RANDOM()").first, terms_of_service: "1") @@ -13,4 +13,4 @@ section "Creating comment notifications" do Notification.add(user, comment) end -end \ No newline at end of file +end diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index 290905032..53eb8dec7 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -1,25 +1,25 @@ section "Creating polls" do - Poll.create(name: I18n.t('seeds.polls.current_poll'), + Poll.create(name: I18n.t("seeds.polls.current_poll"), starts_at: 7.days.ago, ends_at: 7.days.from_now, geozone_restricted: false) - Poll.create(name: I18n.t('seeds.polls.current_poll_geozone_restricted'), + Poll.create(name: I18n.t("seeds.polls.current_poll_geozone_restricted"), starts_at: 5.days.ago, ends_at: 5.days.from_now, geozone_restricted: true, geozones: Geozone.reorder("RANDOM()").limit(3)) - Poll.create(name: I18n.t('seeds.polls.recounting_poll'), + Poll.create(name: I18n.t("seeds.polls.recounting_poll"), starts_at: 15.days.ago, ends_at: 2.days.ago) - Poll.create(name: I18n.t('seeds.polls.expired_poll_without_stats'), + Poll.create(name: I18n.t("seeds.polls.expired_poll_without_stats"), starts_at: 2.months.ago, ends_at: 1.month.ago) - Poll.create(name: I18n.t('seeds.polls.expired_poll_with_stats'), + Poll.create(name: I18n.t("seeds.polls.expired_poll_with_stats"), starts_at: 2.months.ago, ends_at: 1.month.ago, results_enabled: true, @@ -42,7 +42,7 @@ end section "Creating Poll Questions & Answers" do Poll.find_each do |poll| (1..4).to_a.sample.times do - title = Faker::Lorem.sentence(3).truncate(60) + '?' + title = Faker::Lorem.sentence(3).truncate(60) + "?" question = Poll::Question.new(author: User.all.sample, title: title, poll: poll) @@ -118,7 +118,7 @@ section "Creating Poll Voters" do document_number: user.document_number, user: user, poll: poll, - origin: 'booth', + origin: "booth", officer: Poll::Officer.all.sample) end @@ -128,7 +128,7 @@ section "Creating Poll Voters" do document_number: user.document_number, user: user, poll: poll, - origin: 'web', + origin: "web", token: SecureRandom.hex(32)) end diff --git a/db/dev_seeds/proposals.rb b/db/dev_seeds/proposals.rb index d68c09419..fd03690ab 100644 --- a/db/dev_seeds/proposals.rb +++ b/db/dev_seeds/proposals.rb @@ -1,9 +1,9 @@ -IMAGE_FILES = %w{ +IMAGE_FILES = %w[ firdouss-ross-414668-unsplash_846x475.jpg nathan-dumlao-496190-unsplash_713x475.jpg steve-harvey-597760-unsplash_713x475.jpg tim-mossholder-302931-unsplash_713x475.jpg -}.map do |filename| +].map do |filename| File.new(Rails.root.join("db", "dev_seeds", "images", @@ -34,7 +34,7 @@ section "Creating Proposals" do external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1") @@ -54,7 +54,7 @@ section "Creating Archived Proposals" do responsible_name: Faker::Name.name, external_url: Faker::Internet.url, description: description, - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1", @@ -76,7 +76,7 @@ section "Creating Successful Proposals" do external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1", @@ -84,10 +84,10 @@ section "Creating Successful Proposals" do add_image_to proposal end - tags = ActsAsTaggableOn::Tag.where(kind: 'category') + tags = ActsAsTaggableOn::Tag.where(kind: "category") 30.times do author = User.all.sample - description = "

#{Faker::Lorem.paragraphs.join('

')}

" + description = "

#{Faker::Lorem.paragraphs.join("

")}

" proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(4).truncate(60), question: Faker::Lorem.sentence(6) + "?", @@ -96,7 +96,7 @@ section "Creating Successful Proposals" do external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1") diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index af71c6ccc..0b3fc5d58 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -1,76 +1,76 @@ section "Creating Settings" do - Setting.create(key: 'official_level_1_name', - value: I18n.t('seeds.settings.official_level_1_name')) - Setting.create(key: 'official_level_2_name', - value: I18n.t('seeds.settings.official_level_2_name')) - Setting.create(key: 'official_level_3_name', - value: I18n.t('seeds.settings.official_level_3_name')) - Setting.create(key: 'official_level_4_name', - value: I18n.t('seeds.settings.official_level_4_name')) - Setting.create(key: 'official_level_5_name', - value: I18n.t('seeds.settings.official_level_5_name')) - Setting.create(key: 'max_ratio_anon_votes_on_debates', value: '50') - Setting.create(key: 'max_votes_for_debate_edit', value: '1000') - Setting.create(key: 'max_votes_for_proposal_edit', value: '1000') - Setting.create(key: 'proposal_code_prefix', value: 'MAD') - Setting.create(key: 'votes_for_proposal_success', value: '100') - Setting.create(key: 'months_to_archive_proposals', value: '12') - Setting.create(key: 'comments_body_max_length', value: '1000') + Setting.create(key: "official_level_1_name", + value: I18n.t("seeds.settings.official_level_1_name")) + Setting.create(key: "official_level_2_name", + value: I18n.t("seeds.settings.official_level_2_name")) + Setting.create(key: "official_level_3_name", + value: I18n.t("seeds.settings.official_level_3_name")) + Setting.create(key: "official_level_4_name", + value: I18n.t("seeds.settings.official_level_4_name")) + Setting.create(key: "official_level_5_name", + value: I18n.t("seeds.settings.official_level_5_name")) + Setting.create(key: "max_ratio_anon_votes_on_debates", value: "50") + Setting.create(key: "max_votes_for_debate_edit", value: "1000") + Setting.create(key: "max_votes_for_proposal_edit", value: "1000") + Setting.create(key: "proposal_code_prefix", value: "MAD") + Setting.create(key: "votes_for_proposal_success", value: "100") + Setting.create(key: "months_to_archive_proposals", value: "12") + Setting.create(key: "comments_body_max_length", value: "1000") - Setting.create(key: 'twitter_handle', value: '@consul_dev') - Setting.create(key: 'twitter_hashtag', value: '#consul_dev') - Setting.create(key: 'facebook_handle', value: 'CONSUL') - Setting.create(key: 'youtube_handle', value: 'CONSUL') - Setting.create(key: 'telegram_handle', value: 'CONSUL') - Setting.create(key: 'instagram_handle', value: 'CONSUL') - Setting.create(key: 'url', value: 'http://localhost:3000') - Setting.create(key: 'org_name', value: 'CONSUL') + Setting.create(key: "twitter_handle", value: "@consul_dev") + Setting.create(key: "twitter_hashtag", value: "#consul_dev") + Setting.create(key: "facebook_handle", value: "CONSUL") + Setting.create(key: "youtube_handle", value: "CONSUL") + Setting.create(key: "telegram_handle", value: "CONSUL") + Setting.create(key: "instagram_handle", value: "CONSUL") + Setting.create(key: "url", value: "http://localhost:3000") + Setting.create(key: "org_name", value: "CONSUL") - Setting.create(key: 'feature.debates', value: "true") - Setting.create(key: 'feature.proposals', value: "true") - Setting.create(key: 'feature.featured_proposals', value: "true") - Setting.create(key: 'feature.polls', value: "true") - Setting.create(key: 'feature.spending_proposals', value: nil) - Setting.create(key: 'feature.spending_proposal_features.voting_allowed', value: nil) - Setting.create(key: 'feature.budgets', value: "true") - Setting.create(key: 'feature.twitter_login', value: "true") - Setting.create(key: 'feature.facebook_login', value: "true") - Setting.create(key: 'feature.google_login', value: "true") - Setting.create(key: 'feature.signature_sheets', value: "true") - Setting.create(key: 'feature.legislation', value: "true") - Setting.create(key: 'feature.user.recommendations', value: "true") - Setting.create(key: 'feature.user.recommendations_on_debates', value: "true") - Setting.create(key: 'feature.user.recommendations_on_proposals', value: "true") - Setting.create(key: 'feature.community', value: "true") - Setting.create(key: 'feature.map', value: "true") - Setting.create(key: 'feature.allow_images', value: "true") - Setting.create(key: 'feature.allow_attached_documents', value: "true") - Setting.create(key: 'feature.public_stats', value: "true") - Setting.create(key: 'feature.user.skip_verification', value: "true") - Setting.create(key: 'feature.help_page', value: "true") + Setting.create(key: "feature.debates", value: "true") + Setting.create(key: "feature.proposals", value: "true") + Setting.create(key: "feature.featured_proposals", value: "true") + Setting.create(key: "feature.polls", value: "true") + Setting.create(key: "feature.spending_proposals", value: nil) + Setting.create(key: "feature.spending_proposal_features.voting_allowed", value: nil) + Setting.create(key: "feature.budgets", value: "true") + Setting.create(key: "feature.twitter_login", value: "true") + Setting.create(key: "feature.facebook_login", value: "true") + Setting.create(key: "feature.google_login", value: "true") + Setting.create(key: "feature.signature_sheets", value: "true") + Setting.create(key: "feature.legislation", value: "true") + Setting.create(key: "feature.user.recommendations", value: "true") + Setting.create(key: "feature.user.recommendations_on_debates", value: "true") + Setting.create(key: "feature.user.recommendations_on_proposals", value: "true") + Setting.create(key: "feature.community", value: "true") + Setting.create(key: "feature.map", value: "true") + Setting.create(key: "feature.allow_images", value: "true") + Setting.create(key: "feature.allow_attached_documents", value: "true") + Setting.create(key: "feature.public_stats", value: "true") + Setting.create(key: "feature.user.skip_verification", value: "true") + Setting.create(key: "feature.help_page", value: "true") - Setting.create(key: 'per_page_code_head', value: "") - Setting.create(key: 'per_page_code_body', value: "") - Setting.create(key: 'comments_body_max_length', value: '1000') - Setting.create(key: 'mailer_from_name', value: 'CONSUL') - Setting.create(key: 'mailer_from_address', value: 'noreply@consul.dev') - Setting.create(key: 'meta_title', value: 'CONSUL') - Setting.create(key: 'meta_description', value: 'Citizen participation tool for an open, '\ - 'transparent and democratic government') - Setting.create(key: 'meta_keywords', value: 'citizen participation, open government') - Setting.create(key: 'verification_offices_url', value: 'http://oficinas-atencion-ciudadano.url/') - Setting.create(key: 'min_age_to_participate', value: '16') - Setting.create(key: 'map_latitude', value: 40.41) - Setting.create(key: 'map_longitude', value: -3.7) - Setting.create(key: 'map_zoom', value: 10) - Setting.create(key: 'featured_proposals_number', value: 3) - Setting.create(key: 'proposal_notification_minimum_interval_in_days', value: 0) - Setting.create(key: 'direct_message_max_per_day', value: 3) + Setting.create(key: "per_page_code_head", value: "") + Setting.create(key: "per_page_code_body", value: "") + Setting.create(key: "comments_body_max_length", value: "1000") + Setting.create(key: "mailer_from_name", value: "CONSUL") + Setting.create(key: "mailer_from_address", value: "noreply@consul.dev") + Setting.create(key: "meta_title", value: "CONSUL") + Setting.create(key: "meta_description", value: "Citizen participation tool for an open, "\ + "transparent and democratic government") + Setting.create(key: "meta_keywords", value: "citizen participation, open government") + Setting.create(key: "verification_offices_url", value: "http://oficinas-atencion-ciudadano.url/") + Setting.create(key: "min_age_to_participate", value: "16") + Setting.create(key: "map_latitude", value: 40.41) + Setting.create(key: "map_longitude", value: -3.7) + Setting.create(key: "map_zoom", value: 10) + Setting.create(key: "featured_proposals_number", value: 3) + Setting.create(key: "proposal_notification_minimum_interval_in_days", value: 0) + Setting.create(key: "direct_message_max_per_day", value: 3) - Setting.create(key: 'related_content_score_threshold', value: -0.3) - Setting.create(key: 'hot_score_period_in_days', value: 31) + Setting.create(key: "related_content_score_threshold", value: -0.3) + Setting.create(key: "hot_score_period_in_days", value: 31) - Setting['feature.homepage.widgets.feeds.proposals'] = true - Setting['feature.homepage.widgets.feeds.debates'] = true - Setting['feature.homepage.widgets.feeds.processes'] = true + Setting["feature.homepage.widgets.feeds.proposals"] = true + Setting["feature.homepage.widgets.feeds.debates"] = true + Setting["feature.homepage.widgets.feeds.processes"] = true end diff --git a/db/dev_seeds/tags_categories.rb b/db/dev_seeds/tags_categories.rb index 103570578..3ee08a1cb 100644 --- a/db/dev_seeds/tags_categories.rb +++ b/db/dev_seeds/tags_categories.rb @@ -1,17 +1,17 @@ section "Creating Tags Categories" do - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.associations')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.culture')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.sports')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.social_rights')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.economy')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.employment')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.equity')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.sustainability')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.participation')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.mobility')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.media')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.health')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.transparency')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.security_emergencies')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.environment')) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.associations")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.culture")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.sports")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.social_rights")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.economy")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.employment")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.equity")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.sustainability")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.participation")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.mobility")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.media")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.health")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.transparency")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.security_emergencies")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.environment")) end diff --git a/db/dev_seeds/users.rb b/db/dev_seeds/users.rb index 61cfbd12f..199b16dfb 100644 --- a/db/dev_seeds/users.rb +++ b/db/dev_seeds/users.rb @@ -1,6 +1,6 @@ section "Creating Users" do def create_user(email, username = Faker::Name.name) - password = '12345678' + password = "12345678" User.create!( username: username, email: email, @@ -8,7 +8,7 @@ section "Creating Users" do password_confirmation: password, confirmed_at: Time.current, terms_of_service: "1", - gender: ['Male', 'Female'].sample, + gender: ["Male", "Female"].sample, date_of_birth: rand((Time.current - 80.years)..(Time.current - 16.years)), public_activity: (rand(1..100) > 30) ) @@ -17,61 +17,61 @@ section "Creating Users" do def unique_document_number @document_number ||= 12345678 @document_number += 1 - "#{@document_number}#{[*'A'..'Z'].sample}" + "#{@document_number}#{[*"A".."Z"].sample}" end - admin = create_user('admin@consul.dev', 'admin') + admin = create_user("admin@consul.dev", "admin") admin.create_administrator admin.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) - moderator = create_user('mod@consul.dev', 'moderator') + moderator = create_user("mod@consul.dev", "moderator") moderator.create_moderator moderator.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) - manager = create_user('manager@consul.dev', 'manager') + manager = create_user("manager@consul.dev", "manager") manager.create_manager manager.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) - valuator = create_user('valuator@consul.dev', 'valuator') + valuator = create_user("valuator@consul.dev", "valuator") valuator.create_valuator valuator.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) - poll_officer = create_user('poll_officer@consul.dev', 'Paul O. Fisher') + poll_officer = create_user("poll_officer@consul.dev", "Paul O. Fisher") poll_officer.create_poll_officer poll_officer.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) - poll_officer2 = create_user('poll_officer2@consul.dev', 'Pauline M. Espinosa') + poll_officer2 = create_user("poll_officer2@consul.dev", "Pauline M. Espinosa") poll_officer2.create_poll_officer poll_officer2.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) - create_user('unverified@consul.dev', 'unverified') + create_user("unverified@consul.dev", "unverified") - level_2 = create_user('leveltwo@consul.dev', 'level 2') + level_2 = create_user("leveltwo@consul.dev", "level 2") level_2.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_number: unique_document_number, document_type: "1") - verified = create_user('verified@consul.dev', 'verified') + verified = create_user("verified@consul.dev", "verified") verified.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) [ - I18n.t('seeds.organizations.neighborhood_association'), - I18n.t('seeds.organizations.human_rights'), - 'Greenpeace' + I18n.t("seeds.organizations.neighborhood_association"), + I18n.t("seeds.organizations.human_rights"), + "Greenpeace" ].each do |organization_name| org_user = create_user("#{organization_name.parameterize}@consul.dev", organization_name) org = org_user.create_organization(name: organization_name, responsible_name: Faker::Name.name) diff --git a/db/dev_seeds/votes.rb b/db/dev_seeds/votes.rb index 415e542a2..357d2de59 100644 --- a/db/dev_seeds/votes.rb +++ b/db/dev_seeds/votes.rb @@ -1,5 +1,5 @@ section "Voting Debates, Proposals & Comments" do - not_org_users = User.where(['users.id NOT IN(?)', User.organizations.pluck(:id)]) + not_org_users = User.where(["users.id NOT IN(?)", User.organizations.pluck(:id)]) 100.times do voter = not_org_users.level_two_or_three_verified.all.sample vote = [true, false].sample diff --git a/db/dev_seeds/widgets.rb b/db/dev_seeds/widgets.rb index 5e5e265de..b5742a292 100644 --- a/db/dev_seeds/widgets.rb +++ b/db/dev_seeds/widgets.rb @@ -9,74 +9,88 @@ section "Creating header and cards for the homepage" do end Widget::Card.create!( - title_en: 'CONSUL', - title_es: 'CONSUL', + title_en: "CONSUL", + title_es: "CONSUL", - description_en: 'Free software for citizen participation.', - description_es: 'Software libre para la participación ciudadana.', + description_en: "Free software for citizen participation.", + description_es: "Software libre para la participación ciudadana.", - link_text_en: 'More information', - link_text_es: 'Más información', + link_text_en: "More information", + link_text_es: "Más información", - label_en: 'Welcome to', - label_es: 'Bienvenido a', + label_en: "Welcome to", + label_es: "Bienvenido a", - link_url: 'http://consulproject.org/', + link_url: "http://consulproject.org/", header: true, - image_attributes: create_image_attachment('header') + image_attributes: create_image_attachment("header") ) Widget::Card.create!( - title_en: 'How do debates work?', - title_es: '¿Cómo funcionan los debates?', + title_en: "How do debates work?", + title_es: "¿Cómo funcionan los debates?", - description_en: 'Anyone can open threads on any subject, creating separate spaces where people can discuss the proposed topic. Debates are valued by everybody, to highlight the most important issues.', - description_es: 'Cualquiera puede iniciar un debate sobre cualquier tema, creando un espacio separado donde compartir puntos de vista con otras personas. Los debates son valorados por todos para destacar los temas más importantes.', + description_en: "Anyone can open threads on any subject, creating separate spaces "\ + "where people can discuss the proposed topic. Debates are valued by "\ + "everybody, to highlight the most important issues.", + description_es: "Cualquiera puede iniciar un debate sobre cualquier tema, creando un espacio "\ + "separado donde compartir puntos de vista con otras personas. Los debates son "\ + "valorados por todos para destacar los temas más importantes.", - link_text_en: 'More about debates', - link_text_es: 'Más sobre debates', + link_text_en: "More about debates", + link_text_es: "Más sobre debates", - label_en: 'Debates', - label_es: 'Debates', + label_en: "Debates", + label_es: "Debates", - link_url: 'https://youtu.be/zU_0UN4VajY', + link_url: "https://youtu.be/zU_0UN4VajY", header: false, - image_attributes: create_image_attachment('debate') + image_attributes: create_image_attachment("debate") ) Widget::Card.create!( - title_en: 'How do citizen proposals work?', - title_es: '¿Cómo funcionan las propuestas ciudadanas?', + title_en: "How do citizen proposals work?", + title_es: "¿Cómo funcionan las propuestas ciudadanas?", - description_en: "A space for everyone to create a citizens' proposal and seek supports. Proposals which reach to enough supports will be voted and so, together we can decide the issues that matter to us.", - description_es: 'Un espacio para que el ciudadano cree una propuesta y busque apoyo. Las propuestas que obtengan el apoyo necesario serán votadas. Así juntos podemos decidir sobre los temas que nos importan.', + description_en: "A space for everyone to create a citizen's proposal and seek supports. "\ + "Proposals which reach to enough supports will be voted and so, together we "\ + "can decide the issues that matter to us.", + description_es: "Un espacio para que el ciudadano cree una propuesta y busque apoyo. "\ + "Las propuestas que obtengan el apoyo necesario serán votadas. Así juntos "\ + "podemos decidir sobre los temas que nos importan.", - link_text_en: 'More about proposals', - link_text_es: 'Más sobre propuestas', + link_text_en: "More about proposals", + link_text_es: "Más sobre propuestas", - label_en: 'Citizen proposals', - label_es: 'Propuestas ciudadanas', + label_en: "Citizen proposals", + label_es: "Propuestas ciudadanas", - link_url: 'https://youtu.be/ZHqBpT4uCoM', + link_url: "https://youtu.be/ZHqBpT4uCoM", header: false, - image_attributes: create_image_attachment('proposal') + image_attributes: create_image_attachment("proposal") ) Widget::Card.create!( - title_en: 'How do participatory budgets work?', - title_es: '¿Cómo funcionan los propuestos participativos?', + title_en: "How do participatory budgets work?", + title_es: "¿Cómo funcionan los propuestos participativos?", - description_en: " Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution. Maximum effectiveness and control with satisfaction for everyone.", - description_es: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan directamente cómo gastar parte del presupuesto, con la supervisión y valoración de la institución. Máxima eficacia y control para la satisfacción de todos", + description_en: "Participatory budgets allow citizens to propose and decide directly "\ + "how to spend part of the budget, with monitoring and rigorous evaluation "\ + "of proposals by the institution. Maximum effectiveness and control with "\ + "satisfaction for everyone.", + description_es: "Los presupuestos participativos permiten que los ciudadanos propongan y "\ + "decidan directamente cómo gastar parte del presupuesto, con la supervisión "\ + "y valoración de la institución. Máxima eficacia y control para la "\ + "satisfacción de todos", - link_text_en: 'More about Participatory budgets', - link_text_es: 'Más sobre presupuestos participativos', + link_text_en: "More about Participatory budgets", + link_text_es: "Más sobre presupuestos participativos", - label_en: 'Participatory budgets', - label_es: 'Presupuestos participativos', + label_en: "Participatory budgets", + label_es: "Presupuestos participativos", - link_url: 'https://youtu.be/igQ8KGZdk9c', + link_url: "https://youtu.be/igQ8KGZdk9c", header: false, - image_attributes: create_image_attachment('budget') + image_attributes: create_image_attachment("budget") ) end