Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resultのソート順を修正 #133

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading