-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9fbccd
commit de7b087
Showing
123 changed files
with
48,838 additions
and
1,431 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
db/migrate/20240619121131_add_comment_vote_counter_cache_to_comments.decidim_comments.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
17 changes: 17 additions & 0 deletions
17
...21132_add_valuation_assignments_count_to_decidim_proposals_proposals.decidim_proposals.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.