From 6004e384346436b6c3c8b5d59335939be58a6934 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Thu, 28 Dec 2023 08:51:30 +1100 Subject: [PATCH] Standard --- app/views/timemachine/show.rb | 7 +++---- slices/admin/actions/books/create.rb | 1 - slices/admin/actions/books/update.rb | 1 - slices/admin/views/books/index.rb | 3 +-- slices/micropub/actions/webmentions/create.rb | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/views/timemachine/show.rb b/app/views/timemachine/show.rb index 74d72be..815ccf2 100644 --- a/app/views/timemachine/show.rb +++ b/app/views/timemachine/show.rb @@ -57,9 +57,9 @@ module Adamantium expose :posts_by_month do post_tally = {} posts = post_repo.all_posts - + (DateTime.parse("01-01-#{posts.last.published_at.year}")...DateTime.parse("31-12-#{posts.first.published_at.year}")).each do |date| - post_tally[date.year] ||= {} + post_tally[date.year] ||= {} post_tally[date.year][date.strftime("%m")] ||= {} post_tally[date.year][date.strftime("%m")][date.strftime("%d")] = 0 end @@ -69,13 +69,12 @@ module Adamantium date = post.published_at memo[year][date.strftime("%m")][date.strftime("%d")] += 1 end - podcast_scrobble_repo.listing.each do |scrobble| post_stats[scrobble.listened_at.year][scrobble.listened_at.strftime("%m")][scrobble.listened_at.strftime("%d")] += 1 end - post_stats.sort_by{|k, _| -k} + post_stats.sort_by { |k, _| -k } end private_expose :date do |year:, month:, day:| diff --git a/slices/admin/actions/books/create.rb b/slices/admin/actions/books/create.rb index 489fdf3..f53d95c 100644 --- a/slices/admin/actions/books/create.rb +++ b/slices/admin/actions/books/create.rb @@ -4,7 +4,6 @@ module Admin module Actions module Books class Create < Admin::Action - include Deps["repos.book_repo"] def handle(req, resp) diff --git a/slices/admin/actions/books/update.rb b/slices/admin/actions/books/update.rb index 948a663..2dd58f7 100644 --- a/slices/admin/actions/books/update.rb +++ b/slices/admin/actions/books/update.rb @@ -4,7 +4,6 @@ module Admin module Actions module Books class Update < Admin::Action - include Deps["repos.book_repo"] def handle(req, resp) diff --git a/slices/admin/views/books/index.rb b/slices/admin/views/books/index.rb index 4453e29..5770ba5 100644 --- a/slices/admin/views/books/index.rb +++ b/slices/admin/views/books/index.rb @@ -4,9 +4,8 @@ module Admin module Views module Books class Index < Admin::View - include Deps["repos.book_repo"] - + expose :books do book_repo.list_all end diff --git a/slices/micropub/actions/webmentions/create.rb b/slices/micropub/actions/webmentions/create.rb index 59a2923..a651f25 100644 --- a/slices/micropub/actions/webmentions/create.rb +++ b/slices/micropub/actions/webmentions/create.rb @@ -29,7 +29,7 @@ module Micropub reply[:post_id] = post.id - webmentions_repo.create(reply) + webmentions_repo.create(like) res.body = { result: "Webmention was successful" }.to_json