From bf81b939e6e22a820c0266d4adc34f188ad37bac Mon Sep 17 00:00:00 2001 From: MurakawaTakuya Date: Sun, 29 Dec 2024 23:24:18 +0900 Subject: [PATCH] =?UTF-8?q?result=E3=81=AE=E3=82=BD=E3=83=BC=E3=83=88?= =?UTF-8?q?=E9=A0=86=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/src/routers/resultRouter.ts | 7 ++++++- src/Components/Progress/Progress.tsx | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/src/routers/resultRouter.ts b/functions/src/routers/resultRouter.ts index e7c6be4..2567f96 100644 --- a/functions/src/routers/resultRouter.ts +++ b/functions/src/routers/resultRouter.ts @@ -45,6 +45,7 @@ const getResults = async ( const pendingSnapshot = await baseQuery .where("post", "==", null) .where("deadline", ">", now) + .orderBy("deadline", "asc") // 古いものが先 .get(); const pendingGoals = await processGoals(pendingSnapshot.docs, userList); @@ -52,11 +53,15 @@ const getResults = async ( } if (onlyFinished || (!onlyPending && !onlyFinished)) { - const completedSnapshot = await baseQuery.where("post", "!=", null).get(); + const completedSnapshot = await baseQuery + .where("post", "!=", null) + .orderBy("post.submittedAt", "desc") // 新しいものが先 + .get(); const failedSnapshot = await baseQuery .where("post", "==", null) .where("deadline", "<=", now) + .orderBy("deadline", "desc") // 新しいものが先 .get(); const completedResults = await processGoals( diff --git a/src/Components/Progress/Progress.tsx b/src/Components/Progress/Progress.tsx index e83a1f3..d299cef 100644 --- a/src/Components/Progress/Progress.tsx +++ b/src/Components/Progress/Progress.tsx @@ -75,8 +75,6 @@ export default function Progress({ : getUpdatedTime(a) - getUpdatedTime(b); // 最古が上位 }); - console.log("allResults: ", allResults); - return ( <> {allResults.map((result) => {