From 5e571debbd0ade656e24e6946ca7b3139083807c Mon Sep 17 00:00:00 2001 From: rjtt17 Date: Wed, 25 Aug 2021 21:30:16 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=AF=E3=83=86?= =?UTF-8?q?=E3=82=A3=E3=82=B9=E3=81=AE=E9=80=B2=E6=8D=97=E3=82=92=20%=20?= =?UTF-8?q?=E3=81=A7=E3=81=AA=E3=81=8F=E5=AE=8C=E4=BA=86=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=AF=E3=83=86=E3=82=A3=E3=82=B9=E3=81=AE?= =?UTF-8?q?=E5=80=8B=E6=95=B0=E3=81=B8=E3=81=AE=E8=A1=A8=E7=A4=BA=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/user_decorator.rb | 6 ++++++ app/javascript/user-practice-progress.vue | 5 +++-- app/models/user.rb | 19 +++++++++++++------ app/views/api/users/_list_user.json.jbuilder | 2 +- .../_completed_practices_progress.html.slim | 3 ++- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index 411fa3d8eba..76057208113 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -50,6 +50,12 @@ def cached_completed_percentage end end + def cached_completed_fraction + Rails.cache.fetch "/model/user/#{id}/completed_fraction" do + completed_fraction + end + end + def customer_url "https://dashboard.stripe.com/customers/#{customer_id}" end diff --git a/app/javascript/user-practice-progress.vue b/app/javascript/user-practice-progress.vue index b15e1f52602..b04a24ef902 100644 --- a/app/javascript/user-practice-progress.vue +++ b/app/javascript/user-practice-progress.vue @@ -10,7 +10,7 @@ :style='`width: ${roundedPercentage}`' ) .completed-practices-progress__percentage-number - | {{ roundedPercentage }} + | {{ fraction }}