Skip to content

Commit

Permalink
chore: fix activity stats
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Jul 27, 2024
1 parent 139090f commit 3d63d9d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions web/src/components/UserStatisticsView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Divider, Tooltip } from "@mui/joy";
import clsx from "clsx";
import dayjs from "dayjs";
import { chain } from "lodash-es";
import { countBy } from "lodash-es";
import { useState } from "react";
import toast from "react-hot-toast";
import { memoServiceClient } from "@/grpcweb";
Expand Down Expand Up @@ -53,14 +53,9 @@ const UserStatisticsView = () => {
memoStats.incompleteTasks += 1;
}
});
const displayTimes = entities.map((entity) => entity.displayTime).filter(Boolean) as Date[];
const monthStrGroup = chain(displayTimes)
.map((date) => dayjs(date).format("YYYY-MM-DD"))
.countBy()
.value();
setMemoStats(memoStats);
setMemoAmount(entities.length);
setActivityStats(monthStrGroup);
setActivityStats(countBy(entities.map((entity) => dayjs(entity.displayTime).format("YYYY-MM-DD"))));
}, [memoStore.stateId]);

const rebuildMemoTags = async () => {
Expand Down

0 comments on commit 3d63d9d

Please sign in to comment.