Skip to content

Commit

Permalink
Merge branch 'release/0.17.12.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
kalashnikovisme committed May 12, 2017
2 parents 8b63704 + 84676db commit 2d0c2e7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 21 deletions.
3 changes: 0 additions & 3 deletions app/models/news/rating.rb

This file was deleted.

8 changes: 6 additions & 2 deletions bin/data_fixes/user_to_member_fix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
puts "Tags migration...".green
Tag.where(target_id: user.id, target_type: 'Member').update_all target_id: member.id
puts "Event organizer_id migrations...".green
Event.where(organizer_id: user.id, organizer_type: [ 'User', 'Member' ]).update_attributes! organizer_id: member.id
Event.where(organizer_id: user.id, organizer_type: [ 'User', 'Member' ]).map do |e|
e.update_attributes! organizer_id: member.id
end
puts "Event creator_id migrations...".green
Event.where(creator_id: user.id).update_attributes! creator_id: member.id
Event.where(creator_id: user.id).map do |e|
e.update_attributes! creator_id: member.id
end
puts "Destroy old user...".green
user.destroy
else
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20170512220919_remove_news_ratings_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveNewsRatingsTable < ActiveRecord::Migration
def change
drop_table :news_ratings
end
end
5 changes: 5 additions & 0 deletions db/migrate/20170512222114_add_main_position_title_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddMainPositionTitleToUsers < ActiveRecord::Migration
def change
add_column :users, :main_position_title, :text
end
end
22 changes: 7 additions & 15 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170509182902) do
ActiveRecord::Schema.define(version: 20170512222114) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -402,15 +402,6 @@
t.integer "views", default: 0
end

create_table "news_ratings", force: :cascade do |t|
t.integer "news_id"
t.integer "rating"
t.integer "views_count"
t.integer "round"
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.integer "application_id", null: false
Expand Down Expand Up @@ -630,17 +621,18 @@
t.text "experience"
t.text "want_to_do"
t.string "type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "join_date"
t.text "token"
t.text "school"
t.text "member_state", default: "unviewed"
t.text "member_state", default: "unviewed"
t.datetime "request_date"
t.text "corporate_email"
t.text "source_to_know"
t.text "questionary_state", default: "not_existed"
t.text "email_state", default: "active"
t.text "questionary_state", default: "not_existed"
t.text "email_state", default: "active"
t.text "main_position_title"
end

create_table "views", force: :cascade do |t|
Expand Down
17 changes: 17 additions & 0 deletions lib/tasks/cron/update_members_position.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace :members do
desc 'Update main position'
task update_member_main_position: :environment do
count = Member.confirmed.count
Member.confirmed.find_each.with_index do |member, index|
main_position_title = member.decorate.main_position_title
unless member.update_attributes main_position_title: main_position_title
puts member.id
puts member.email
puts member.errors.messages
break
end
print "#{index} of #{count}\r"
end
puts "Members updated!"
end
end
2 changes: 1 addition & 1 deletion lib/tasks/cron/update_news_ratings.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace :news do
count = News.count
News.order(id: :desc).find_each.with_index do |news, index|
news.update_attributes! views: news.page_views.count
puts "#{index} of #{count}\r"
print "#{index} of #{count}\r"
end
puts "News updated!"
end
Expand Down

0 comments on commit 2d0c2e7

Please sign in to comment.