Skip to content

Commit c649862

Browse files
author
Pietro
committed
Good practices hidden
1 parent abbffee commit c649862

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

app/models/story.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ def check_type
136136

137137
# The queries are performed only if needed
138138
update_column(:welfare_provision, is_wp) if is_wp != welfare_provision?
139-
update_column(:good_practice, is_gp) if is_gp != good_practice?
139+
# No more good_practice
140+
# update_column(:good_practice, is_gp) if is_gp != good_practice?
140141
update_column(:tutorial, is_tutorial) if is_tutorial != tutorial?
141142
end
142143

app/views/layouts/_navbar.html.erb

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
<li class="nav-item active">
3838
<%= link_to s_('Navbar|Commoners Voices'), stories_path(filter: :commoners_voice), class: 'nav-link nav-item--single-line' %>
3939
</li>
40-
<li class="nav-item active">
41-
<%= link_to s_('Navbar|Good Practices'), stories_path(filter: :good_practice), class: 'nav-link nav-item--single-line' %>
42-
</li>
40+
<!-- <li class="nav-item active"> -->
41+
<%#= link_to s_('Navbar|Good Practices'), stories_path(filter: :good_practice), class: 'nav-link nav-item--single-line' %>
42+
<!-- </li> -->
4343
<li class="nav-item active">
4444
<%= link_to s_('Navbar|Public Benefits'), stories_path(filter: :welfare_provision), class: 'nav-link nav-item--single-line' %>
4545
</li>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class AddWasGoodPracticeToStories < ActiveRecord::Migration[5.1]
2+
def change
3+
add_column :stories, :was_good_practice, :boolean, default: false
4+
add_index :stories, :was_good_practice
5+
6+
# Update existing Good Practices
7+
Story.find_each do |story|
8+
if story.good_practice?
9+
story.update_column(:was_good_practice, true)
10+
story.update_column(:good_practice, false)
11+
end
12+
end
13+
end
14+
end

db/schema.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20190122121229) do
13+
ActiveRecord::Schema.define(version: 20190402071356) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
@@ -220,12 +220,14 @@
220220
t.bigint "group_id"
221221
t.jsonb "template_json"
222222
t.boolean "tutorial", default: false
223+
t.boolean "was_good_practice", default: false
223224
t.index ["anonymous"], name: "index_stories_on_anonymous"
224225
t.index ["commoner_id"], name: "index_stories_on_commoner_id"
225226
t.index ["good_practice"], name: "index_stories_on_good_practice"
226227
t.index ["group_id"], name: "index_stories_on_group_id"
227228
t.index ["slug"], name: "index_stories_on_slug", unique: true
228229
t.index ["tutorial"], name: "index_stories_on_tutorial"
230+
t.index ["was_good_practice"], name: "index_stories_on_was_good_practice"
229231
t.index ["welfare_provision"], name: "index_stories_on_welfare_provision"
230232
end
231233

0 commit comments

Comments
 (0)