-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store approach and article order (#6690)
* Add position to approaches and articles * Add scope for sorted articles and approaches * Fix factories * Sync article and approach order as found in config * Dig deeper page shows articles and approaches in order * Make position ordering default scope
- Loading branch information
1 parent
8664c3a
commit 193a09a
Showing
14 changed files
with
78 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
13 changes: 13 additions & 0 deletions
13
db/migrate/20240118102648_add_position_to_exercise_approaches.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,13 @@ | ||
class AddPositionToExerciseApproaches < ActiveRecord::Migration[7.0] | ||
def change | ||
return if Rails.env.production? | ||
|
||
add_column :exercise_approaches, :position, :integer, null: true, limit: 1 | ||
add_index :exercise_approaches, [:exercise_id, :position] | ||
|
||
# The positions will be fixed manually by running Git::SyncTrack.() | ||
Exercise::Approach.update_all(position: 0) | ||
|
||
change_column_null :exercise_approaches, :position, false | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
db/migrate/20240118102652_add_position_to_exercise_articles.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,13 @@ | ||
class AddPositionToExerciseArticles < ActiveRecord::Migration[7.0] | ||
def change | ||
return if Rails.env.production? | ||
|
||
add_column :exercise_articles, :position, :integer, null: true, limit: 1 | ||
add_index :exercise_articles, [:exercise_id, :position] | ||
|
||
# The positions will be fixed manually by running Git::SyncTrack.() | ||
Exercise::Article.update_all(position: 0) | ||
|
||
change_column_null :exercise_articles, :position, false | ||
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
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