From 511557460ee7e5395d9e9e0111f5a6ca2586ebb7 Mon Sep 17 00:00:00 2001 From: naoki1510 <15890587+naoki1510@users.noreply.github.com> Date: Sat, 9 Mar 2024 15:12:33 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E5=89=8A=E9=99=A4=E6=99=82=E3=81=AE?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E7=95=AA=E5=8F=B7=E3=81=AE=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E3=82=92=E8=A7=A3=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/models/question.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/app/models/question.rb b/api/app/models/question.rb index 32270e5..b7f898f 100644 --- a/api/app/models/question.rb +++ b/api/app/models/question.rb @@ -4,6 +4,7 @@ class Question < ApplicationRecord has_many :users, through: :answers before_save :set_display_order + after_destroy :reduce_display_order scope :ordered, -> { order(display_order: :asc) } scope :active, -> { where("started_at <= ? AND ? < ended_at", Time.current, Time.current) } @@ -45,4 +46,8 @@ def set_display_order end end + def reduce_display_order + Question.where("display_order > ?", self.display_order).update_all("display_order = display_order - 1") + end + end \ No newline at end of file From 498d24d6e4a8b24f19d64b168609a95779202b38 Mon Sep 17 00:00:00 2001 From: naoki1510 <15890587+naoki1510@users.noreply.github.com> Date: Sun, 10 Mar 2024 18:11:24 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=82=A8=E3=82=AF=E3=82=B9=E3=83=9D?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/users/ListUsers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/users/ListUsers.tsx b/client/src/components/users/ListUsers.tsx index b42cdf6..5417de4 100644 --- a/client/src/components/users/ListUsers.tsx +++ b/client/src/components/users/ListUsers.tsx @@ -34,7 +34,7 @@ export default memo(function ListUsers() { //createObjectURLで作成したオブジェクトURLを開放する URL.revokeObjectURL(link.href); - }, []); + }, [users]); return (