Skip to content

Commit

Permalink
several upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Jul 5, 2024
1 parent fbe065d commit 05af3c6
Show file tree
Hide file tree
Showing 121 changed files with 48,627 additions and 1,383 deletions.
360 changes: 181 additions & 179 deletions Gemfile.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ <h2>
<li><code><a href="/api/docs/object/meetings">Meetings</a></code></li>
<li><code><a href="/api/docs/object/pages">Pages</a></code></li>
<li><code><a href="/api/docs/object/proposals">Proposals</a></code></li>
<li><code><a href="/api/docs/object/result">Result</a></code></li>
<li><code><a href="/api/docs/object/sortitions">Sortitions</a></code></li>
<li><code><a href="/api/docs/object/surveys">Surveys</a></code></li>
</ul>
Expand Down
33 changes: 10 additions & 23 deletions app/views/static/api/docs/object/result/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,20 @@ <h2>
<ul>
<li><code><a href="/api/docs/interface/categorizableinterface">CategorizableInterface</a></code></li>
<li><code><a href="/api/docs/interface/commentableinterface">CommentableInterface</a></code></li>
<li><code><a href="/api/docs/interface/componentinterface">ComponentInterface</a></code></li>
<li><code><a href="/api/docs/interface/scopableinterface">ScopableInterface</a></code></li>
</ul>
<h2>
<a id="fields" class="anchor" href="#fields" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Fields</h2>
<div class="field-entry ">
<span id="id" class="field-name anchored">id (<code><a href="/api/docs/scalar/id">ID!</a></code>)</span>
<div class="description-wrapper">
<p>The internal ID for this result</p>
</div>
</div>
<div class="field-entry ">
<span id="name" class="field-name anchored">name (<code><a href="/api/docs/object/translatedfield">TranslatedField!</a></code>)</span>
<div class="description-wrapper">
<p>The name of this component.</p>
</div>
</div>
<div class="field-entry ">
<span id="weight" class="field-name anchored">weight (<code><a href="/api/docs/scalar/int">Int!</a></code>)</span>
<div class="description-wrapper">
<p>The order of this result</p>
</div>
</div>
<div class="field-entry ">
<span id="participatoryspace" class="field-name anchored">participatorySpace (<code><a href="/api/docs/object/participatoryspace">ParticipatorySpace!</a></code>)</span>
<span id="category" class="field-name anchored">category (<code><a href="/api/docs/object/category">Category</a></code>)</span>
<div class="description-wrapper">
<p>The participatory space in which this component belongs to.</p>
<p>The object's category</p>
</div>
</div>
<div class="field-entry ">
<span id="category" class="field-name anchored">category (<code><a href="/api/docs/object/category">Category</a></code>)</span>
<span id="id" class="field-name anchored">id (<code><a href="/api/docs/scalar/id">ID!</a></code>)</span>
<div class="description-wrapper">
<p>The object's category</p>
<p>The internal ID for this result</p>
</div>
</div>
<div class="field-entry ">
Expand Down Expand Up @@ -177,6 +158,12 @@ <h2>
<p>The number of children results</p>
</div>
</div>
<div class="field-entry ">
<span id="weight" class="field-name anchored">weight (<code><a href="/api/docs/scalar/int">Int!</a></code>)</span>
<div class="description-wrapper">
<p>The order of this result</p>
</div>
</div>
<div class="field-entry ">
<span id="externalid" class="field-name anchored">externalId (<code><a href="/api/docs/scalar/string">String</a></code>)</span>
<div class="description-wrapper">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true
# This migration comes from decidim_comments (originally 20240304092558)

class AddCommentVoteCounterCacheToComments < ActiveRecord::Migration[6.1]
def change
add_column :decidim_comments_comments, :up_votes_count, :integer, null: false, default: 0, index: true
add_column :decidim_comments_comments, :down_votes_count, :integer, null: false, default: 0, index: true

# We cannot use the reset_counters as up_votes and down_votes are scoped associationws
reversible do |dir|
dir.up do
Decidim::Comments::Comment.reset_column_information
Decidim::Comments::Comment.find_each do |record|
# rubocop:disable Rails/SkipsModelValidations
record.class.update_counters(record.id, up_votes_count: record.up_votes.length)
record.class.update_counters(record.id, down_votes_count: record.down_votes.length)
# rubocop:enable Rails/SkipsModelValidations
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true
# This migration comes from decidim_proposals (originally 20240404202756)

class AddValuationAssignmentsCountToDecidimProposalsProposals < ActiveRecord::Migration[6.1]
def change
add_column :decidim_proposals_proposals, :valuation_assignments_count, :integer, default: 0

reversible do |dir|
dir.up do
Decidim::Proposals::Proposal.reset_column_information
Decidim::Proposals::Proposal.find_each do |record|
Decidim::Proposals::Proposal.reset_counters(record.id, :valuation_assignments)
end
end
end
end
end
88 changes: 5 additions & 83 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_12_01_123203) do
ActiveRecord::Schema.define(version: 2024_07_05_123825) do

# These are extensions that must be enabled in order to support this database
enable_extension "ltree"
Expand Down Expand Up @@ -45,17 +45,6 @@
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end

create_table "coauthorships", id: false, force: :cascade do |t|
t.bigint "id", null: false
t.bigint "decidim_author_id", null: false
t.bigint "decidim_user_group_id"
t.string "coauthorable_type"
t.bigint "coauthorable_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "decidim_author_type", null: false
end

create_table "decidim_accountability_results", id: :serial, force: :cascade do |t|
t.jsonb "title"
t.jsonb "description"
Expand Down Expand Up @@ -334,7 +323,7 @@
t.index ["decidim_organization_id"], name: "decidim_awesome_editor_images_constraint_organization"
end

create_table "decidim_awesome_proposal_extra_fields", force: :cascade do |t|
create_table "decidim_awesome_proposal_extra_fields", id: :bigint, default: -> { "nextval('decidim_awesome_weight_caches_id_seq'::regclass)" }, force: :cascade do |t|
t.bigint "decidim_proposal_id", null: false
t.jsonb "vote_weight_totals"
t.integer "weight_total", default: 0
Expand All @@ -351,15 +340,6 @@
t.index ["proposal_vote_id"], name: "decidim_awesome_proposals_weights_vote"
end

create_table "decidim_awesome_weight_caches", force: :cascade do |t|
t.bigint "decidim_proposal_id", null: false
t.jsonb "totals"
t.integer "weight_total", default: 0
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["decidim_proposal_id"], name: "decidim_awesome_proposals_weights_cache"
end

create_table "decidim_blogs_posts", id: :serial, force: :cascade do |t|
t.jsonb "title"
t.jsonb "body"
Expand Down Expand Up @@ -598,6 +578,8 @@
t.string "decidim_participatory_space_type"
t.integer "decidim_participatory_space_id"
t.datetime "deleted_at"
t.integer "up_votes_count", default: 0, null: false
t.integer "down_votes_count", default: 0, null: false
t.index ["created_at"], name: "index_decidim_comments_comments_on_created_at"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_comments_comments_on_decidim_author"
t.index ["decidim_author_id"], name: "decidim_comments_comment_author"
Expand Down Expand Up @@ -825,56 +807,6 @@
t.index ["endorsements_count"], name: "idx_decidim_debates_debates_on_endorsemnts_count"
end

create_table "decidim_dummy_resources_coauthorable_dummy_resources", force: :cascade do |t|
t.jsonb "translatable_text"
t.string "title"
t.string "body"
t.text "address"
t.float "latitude"
t.float "longitude"
t.datetime "published_at"
t.integer "coauthorships_count", default: 0, null: false
t.integer "endorsements_count", default: 0, null: false
t.integer "comments_count", default: 0, null: false
t.bigint "decidim_component_id"
t.bigint "decidim_category_id"
t.bigint "decidim_scope_id"
t.string "reference"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "decidim_dummy_resources_dummy_resources", force: :cascade do |t|
t.jsonb "translatable_text"
t.jsonb "title"
t.string "body"
t.text "address"
t.float "latitude"
t.float "longitude"
t.datetime "published_at"
t.integer "coauthorships_count", default: 0, null: false
t.integer "endorsements_count", default: 0, null: false
t.integer "comments_count", default: 0, null: false
t.integer "follows_count", default: 0, null: false
t.bigint "decidim_component_id"
t.integer "decidim_author_id"
t.string "decidim_author_type"
t.integer "decidim_user_group_id"
t.bigint "decidim_category_id"
t.bigint "decidim_scope_id"
t.string "reference"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "decidim_dummy_resources_nested_dummy_resources", force: :cascade do |t|
t.jsonb "translatable_text"
t.string "title"
t.bigint "dummy_resource_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "decidim_editor_images", force: :cascade do |t|
t.bigint "decidim_author_id", null: false
t.bigint "decidim_organization_id", null: false
Expand Down Expand Up @@ -1584,6 +1516,7 @@
t.jsonb "body"
t.integer "comments_count", default: 0, null: false
t.integer "follows_count", default: 0, null: false
t.integer "valuation_assignments_count", default: 0
t.index "md5((body)::text)", name: "decidim_proposals_proposal_body_search"
t.index "md5((title)::text)", name: "decidim_proposals_proposal_title_search"
t.index ["created_at"], name: "index_decidim_proposals_proposals_on_created_at"
Expand Down Expand Up @@ -2001,17 +1934,6 @@
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
end

create_table "endorsements", id: false, force: :cascade do |t|
t.bigint "id", null: false
t.string "resource_type"
t.bigint "resource_id"
t.string "decidim_author_type"
t.bigint "decidim_author_id"
t.integer "decidim_user_group_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "oauth_access_grants", force: :cascade do |t|
t.integer "resource_owner_id", null: false
t.bigint "application_id", null: false
Expand Down
Loading

0 comments on commit 05af3c6

Please sign in to comment.