render different reports in partials

This commit is contained in:
Joffrey JAFFEUX 2024-12-12 15:28:44 +01:00
parent 0a8aa07078
commit 89d78e5401
4 changed files with 5 additions and 10 deletions

View File

@ -8,7 +8,7 @@ module DiscourseRewind
option :date option :date
def call def call
reading_time = UserVisit.where(user: user).where(visited_at: date).sum(:time_read) reading_time = UserVisit.where(user_id: user.id).where(visited_at: date).sum(:time_read)
{ {
data: { data: {
@ -41,7 +41,7 @@ module DiscourseRewind
"And Then There Were None" => 16_200, "And Then There Were None" => 16_200,
"The Alchemist" => 10_800, "The Alchemist" => 10_800,
"The Hitchhiker's Guide to the Galaxy" => 12_600, "The Hitchhiker's Guide to the Galaxy" => 12_600,
} }.symbolize_keys
end end
def best_book_fit(reading_time) def best_book_fit(reading_time)

View File

@ -0,0 +1 @@
POSTING CALENDAR

View File

@ -0,0 +1 @@
READING TIME

View File

@ -16,14 +16,7 @@
<div class="rewind__wrapper"> <div class="rewind__wrapper">
<div class="rewind"> <div class="rewind">
<%- @reports.each do |report| %> <%- @reports.each do |report| %>
<div class="rewind__report"> <%= render report[:identifier] %>
<div class="rewind__report__header">
<%= report[:identifier] %>
</div>
<div class="rewind__report__body">
<%= report[:data][:count] %>
</div>
</div>
<%- end %> <%- end %>
</div> </div>
</div> </div>