2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-26 18:17:10 +08:00
|
|
|
Report.add_report('bookmarks') do |report|
|
2019-03-29 17:54:56 +08:00
|
|
|
report.icon = 'bookmark'
|
2019-04-26 18:17:10 +08:00
|
|
|
|
2020-04-22 11:44:19 +08:00
|
|
|
category_filter = report.filters.dig(:category)
|
|
|
|
report.add_filter('category', default: category_filter)
|
|
|
|
|
|
|
|
report.data = []
|
|
|
|
Bookmark.count_per_day(
|
|
|
|
category_id: category_filter,
|
|
|
|
start_date: report.start_date,
|
|
|
|
end_date: report.end_date
|
|
|
|
).each do |date, count|
|
|
|
|
report.data << { x: date, y: count }
|
|
|
|
end
|
|
|
|
add_counts report, Bookmark, 'bookmarks.created_at'
|
2019-03-29 17:54:56 +08:00
|
|
|
end
|