Skip to content

Commit

Permalink
DNM: Fix Experiments publiclab#10
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiisbored committed Dec 31, 2016
1 parent 843ecd7 commit f1629bb
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/controllers/map_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def show

# redirect_old_urls

impressionist(@node.drupal_node_counter, 'view', :unique => [:session_hash])
impressionist(@node.drupal_node_counter)
@title = @node.title
@tags = @node.tags
@tagnames = @tags.collect(&:name)
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ def show

alert_and_redirect_moderated


impressionist(@node.drupal_node_counter, 'view', :unique => [:session_hash])
impressionist(@node.drupal_node_counter)
@title = @node.latest.title
@tags = @node.tags
@tagnames = @tags.collect(&:name)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def show

alert_and_redirect_moderated

impressionist(@node.drupal_node_counter, 'view', :unique => [:session_hash])
impressionist(@node.drupal_node_counter)
@title = @node.latest.title
@tags = @node.power_tag_objects('question')
@tagnames = @tags.collect(&:name)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/wiki_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def show
set_sidebar :tags, @tagnames, {:videos => true}
@wikis = DrupalTag.find_pages(@node.slug_from_path,30) if @node.has_tag('chapter') || @node.has_tag('tabbed:wikis')

impressionist(@node.drupal_node_counter, 'view', :unique => [:session_hash])
impressionist(@node.drupal_node_counter)
@revision = @node.latest
@title = @revision.title
end
Expand Down
4 changes: 1 addition & 3 deletions app/models/drupal_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,9 @@ def tagnames
self.tags.collect(&:name)
end

# increment view count
# view counter is handled by controller
def view
DrupalNodeCounter.new({:nid => self.id}).save if self.drupal_node_counter.nil?
self.drupal_node_counter.totalcount += 1
self.drupal_node_counter.save
end

# view count
Expand Down
6 changes: 1 addition & 5 deletions app/models/drupal_node_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@ class DrupalNodeCounter < ActiveRecord::Base

belongs_to :drupal_node, :foreign_key => 'nid', :dependent => :destroy

is_impressionable

def totalcount
impressionist_count(:filter=>:ip_address)
end
is_impressionable :counter_cache => true, :column_name => :totalcount, :unique => :ip_address
end
10 changes: 3 additions & 7 deletions config/initializers/impression.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Use this hook to configure impressionist parameters
#Impressionist.setup do |config|
Impressionist.setup do |config|
# Define ORM. Could be :active_record (default), :mongo_mapper or :mongoid
# config.orm = :active_record
#end



config.orm = :active_record
end

0 comments on commit f1629bb

Please sign in to comment.