From e6c03df13f9bf7d0d6e27e1fbc7cecb54cd280f0 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 1 Jul 2022 15:01:57 -0300 Subject: [PATCH 1/4] =?UTF-8?q?mostrar=20las=20estadisticas=20en=20el=20me?= =?UTF-8?q?n=C3=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/index.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index accfdb34..c6ffc2f5 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -21,6 +21,9 @@ - if policy(@site).private? = link_to t('sites.private'), '../private/' + @site.name, class: 'btn', target: '_blank', rel: 'noopener' + - if policy(SiteStat.new(@site)).index? + = link_to t('stats.index.title'), site_stats_path(@site), class: 'btn' + - if policy(SiteUsuarie.new(@site, current_usuarie)).index? = render 'layouts/btn_with_tooltip', tooltip: t('usuaries.index.help.self'), From f1137c6ed28c5245f27865c489904a1012f119b3 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 1 Jul 2022 15:02:17 -0300 Subject: [PATCH 2/4] error de sintaxis --- config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/application.rb b/config/application.rb index 7c530e69..f1bf8365 100644 --- a/config/application.rb +++ b/config/application.rb @@ -38,6 +38,7 @@ module Sutty config.active_storage.variant_processor = :vips + config.to_prepare do # Load application's model / class decorators Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c| Rails.configuration.cache_classes ? require(c) : load(c) From 332ae66b8a54636b9bafea7f992719deb6af8122 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 15 Jul 2022 13:19:08 -0300 Subject: [PATCH 3/4] =?UTF-8?q?no=20juntar=20estad=C3=ADsticas=20por=20mes?= =?UTF-8?q?=20y=20a=C3=B1o=20todav=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit la forma en que las estamos recopilando es rápida pero no acumulativa, entonces los números siempre dan mal. --- app/models/stat.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/stat.rb b/app/models/stat.rb index f1016026..6c681aa4 100644 --- a/app/models/stat.rb +++ b/app/models/stat.rb @@ -3,7 +3,7 @@ # Registran cuándo fue la última recolección de datos. class Stat < ApplicationRecord # XXX: Los intervalos van en orden de mayor especificidad a menor - INTERVALS = %i[day month year].freeze + INTERVALS = %i[day].freeze RESOURCES = %i[builds space_used build_time].freeze COLUMNS = %i[http_referer geoip2_data_country_name].freeze From 091ceac788595edf537d81ffd929c0dc5084f230 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 15 Jul 2022 14:17:46 -0300 Subject: [PATCH 4/4] =?UTF-8?q?bot=C3=B3n=20de=20estad=C3=ADsticas=20m?= =?UTF-8?q?=C3=A1s=20arriba?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/posts_controller.rb | 2 ++ app/views/posts/index.haml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index e6f836bb..c5dc0f54 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -35,6 +35,8 @@ class PostsController < ApplicationController # Filtrar los posts que les invitades no pueden ver @usuarie = site.usuarie? current_usuarie + + @site_stat = SiteStat.new(site) end def show diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index c6ffc2f5..bc5c826c 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -15,15 +15,15 @@ - else %td= link_to t('posts.filter'), site_posts_path(@site, **@filter_params.merge(layout: layout.value)), class: 'btn btn-secondary btn-sm' + - if policy(@site_stat).index? + = link_to t('stats.index.title'), site_stats_path(@site), class: 'btn' + - if policy(@site).edit? = link_to t('sites.edit.btn', site: @site.title), edit_site_path(@site), class: 'btn' - if policy(@site).private? = link_to t('sites.private'), '../private/' + @site.name, class: 'btn', target: '_blank', rel: 'noopener' - - if policy(SiteStat.new(@site)).index? - = link_to t('stats.index.title'), site_stats_path(@site), class: 'btn' - - if policy(SiteUsuarie.new(@site, current_usuarie)).index? = render 'layouts/btn_with_tooltip', tooltip: t('usuaries.index.help.self'),