Permalink
Browse files

Quick item score updates

  • Loading branch information...
1 parent 524eb0d commit c31d43cc9d3815d447dc1a9af5e16725958e1b8f @chewbranca chewbranca committed Jan 6, 2012
Showing with 17 additions and 13 deletions.
  1. +1 −3 app/models/item_score.rb
  2. +11 −10 app/views/users/_bio_form.html.haml
  3. +5 −0 lib/tasks/n2.rake
View
@@ -23,9 +23,7 @@ def self.get_score item
end
def self.calc_item_score item
- positive_actions_count = ItemAction.tally_for_item(item)
- # ensure positive_actions_count > 0
- positive_actions_count = 1 unless positive_actions_count > 0
+ positive_actions_count = ItemAction.tally_for_item(item) + 1
negative_actions_count = 0 # Eventually change this
score = self.score(positive_actions_count, negative_actions_count)
@@ -1,12 +1,13 @@
.bio-box{:style => "display: none;"}
.bio-content
- - form_tag update_bio_users_path, :class => "update-bio-form formtastic", :id => 'update-bio-form' do
- %fieldset.inputs
- %ol
- %li
- = label_tag :bio_tag, t('label_bio_edit')
- = text_area_tag :bio, current_user.bio, :rows => 10, :cols => 60
- %fieldset.buttons
- %ol
- %li.commit.float-right
- = submit_tag "Update", :class => "button-input"
+ - if current_user
+ - form_tag update_bio_users_path, :class => "update-bio-form formtastic", :id => 'update-bio-form' do
+ %fieldset.inputs
+ %ol
+ %li
+ = label_tag :bio_tag, t('label_bio_edit')
+ = text_area_tag :bio, current_user.bio, :rows => 10, :cols => 60
+ %fieldset.buttons
+ %ol
+ %li.commit.float-right
+ = submit_tag "Update", :class => "button-input"
View
@@ -1,6 +1,11 @@
namespace :n2 do
namespace :data do
+ desc "Rebuild item scores for all models"
+ task :rebuild_item_scores => :environment do
+ ItemScore.rebuild_scores
+ end
+
desc "Bootstrap and convert existing data"
task :bootstrap => [:environment, :delete_floating_content, :delete_floating_comments, :delete_floating_ideas, :delete_floating_questions_and_answers, :update_floating_comments, :generate_model_slugs, :generate_widgets, :load_seed_data, :convert_images_to_paperclip, :load_locale_data] do
puts "Finished Bootstrapping and converting existing data"

0 comments on commit c31d43c

Please sign in to comment.