Skip to content

Commit

Permalink
resultのソート順を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
MurakawaTakuya committed Dec 29, 2024
1 parent dd7df81 commit bafab41
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/src/routers/resultRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,23 @@ const getResults = async (
const pendingSnapshot = await baseQuery
.where("post", "==", null)
.where("deadline", ">", now)
.orderBy("deadline", "asc") // 古いものが先
.get();

const pendingGoals = await processGoals(pendingSnapshot.docs, userList);
pendingResults.push(...pendingGoals);
}

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(
Expand Down

0 comments on commit bafab41

Please sign in to comment.