Skip to content

Commit

Permalink
Merge pull request #17 from vicomte/master
Browse files Browse the repository at this point in the history
unscope Punch during combine for Postgres
  • Loading branch information
adamcrown committed Nov 11, 2015
2 parents 85d942c + b4f3939 commit 0cc483d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tasks/punching_bag.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ namespace :punching_bag do
task :combine, [:by_hour_after, :by_day_after, :by_month_after, :by_year_after] => [:environment] do |t, args|
args.with_defaults :by_hour_after => 24, :by_day_after => 7, :by_month_after => 1, :by_year_after => 1

punchable_types = Punch.uniq.pluck(:punchable_type)
punchable_types = Punch.unscope(:order).uniq.pluck(:punchable_type)

punchable_types.each do |punchable_type|
punchables = punchable_type.constantize.find(
Punch.uniq.where(punchable_type: punchable_type).pluck(:punchable_id)
Punch.unscope(:order).uniq.where(punchable_type: punchable_type).pluck(:punchable_id)
)

punchables.each do |punchable|
Expand Down

0 comments on commit 0cc483d

Please sign in to comment.