Skip to content

Commit

Permalink
Merge pull request #133 from MurakawaTakuya/fix/result-sort
Browse files Browse the repository at this point in the history
resultのソート順を修正
  • Loading branch information
MurakawaTakuya authored Dec 29, 2024
2 parents dd7df81 + bf81b93 commit 1b1d36d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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
2 changes: 0 additions & 2 deletions src/Components/Progress/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ export default function Progress({
: getUpdatedTime(a) - getUpdatedTime(b); // 最古が上位
});

console.log("allResults: ", allResults);

return (
<>
{allResults.map((result) => {
Expand Down

0 comments on commit 1b1d36d

Please sign in to comment.