Skip to content

Commit

Permalink
feat: Updated app/models/summary/shop.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Feb 3, 2024
1 parent 9d4e802 commit 7b3d8c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/summary/shop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ def summarize

private

def summarized_shop_data
def summarized_shop_data(page: 1, per_page: TOP_SHOPS_LIMIT)
offset = (page - 1) * per_page
result = payments
.select(SQL_QUERY)
.group(:shop)
.order("total_revenue DESC")
.limit(TOP_SHOPS_LIMIT)
.offset(offset)
.limit(per_page)

result.each_with_object({}) do |record, hash|
hash[record.shop] = record.attributes.except("shop")
Expand Down

0 comments on commit 7b3d8c3

Please sign in to comment.