Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Fix timing issue of activity data

Khuram Niaz1a15121d4e79
diff --git a/src/actions/dashboard.actions.ts b/src/actions/dashboard.actions.ts
index 72f0e48..7c9ef51 100644
--- a/src/actions/dashboard.actions.ts
+++ b/src/actions/dashboard.actions.ts
@@ -4,6 +4,7 @@ import { getCurrentUser } from "@/utils/user.utils";
import { Prisma } from "@prisma/client";
import {
addMinutes,
+ endOfDay,
format,
formatISO,
parseISO,
@@ -12,7 +13,7 @@ import {
} from "date-fns";
export const getJobsAppliedForPeriod = async (
- daysAgo: number
+ daysAgo: number,
): Promise<any | undefined> => {
const user = await getCurrentUser();
@@ -88,8 +89,8 @@ export const getActivityDataForPeriod = async (): Promise<any | undefined> => {
if (!user) {
throw new Error("Not authenticated");
}
- const today = new Date();
- const sevenDaysAgo = subDays(today, 6);
+ const today = endOfDay(new Date());
+ const sevenDaysAgo = startOfDay(subDays(new Date(), 6));
const activities = await prisma.activity.findMany({
where: {
userId: user.id,
@@ -146,8 +147,8 @@ export const getJobsActivityForPeriod = async (): Promise<any | undefined> => {
if (!user) {
throw new Error("Not authenticated");
}
- const today = new Date();
- const sevenDaysAgo = subDays(today, 6);
+ const today = endOfDay(new Date());
+ const sevenDaysAgo = startOfDay(subDays(new Date(), 6));
const jobData = await prisma.job.groupBy({
by: "appliedDate",
_count: {
@@ -195,7 +196,7 @@ export const getActivityCalendarData = async (): Promise<any | undefined> => {
if (!user) {
throw new Error("Not authenticated");
}
- const today = new Date();
+ const today = startOfDay(new Date());
const daysAgo = new Date();
daysAgo.setDate(today.getDate() - 365);
const jobData = await prisma.job.groupBy({
@@ -241,7 +242,7 @@ export const getActivityCalendarData = async (): Promise<any | undefined> => {
acc[year].push({ day: date, value });
return acc;
},
- {}
+ {},
);
return groupedByYear;
diff --git a/src/components/dashboard/WeeklyBarChart.tsx b/src/components/dashboard/WeeklyBarChart.tsx
index 982881c..959b295 100644
--- a/src/components/dashboard/WeeklyBarChart.tsx
+++ b/src/components/dashboard/WeeklyBarChart.tsx
@@ -81,15 +81,24 @@ export default function WeeklyBarChart({
truncateTickAt: 0,
}}
motionConfig="gentle"
- // tooltip={({ value, color }) => (
+ // tooltip={({ id, value, color, indexValue }) => (
// <div
// style={{
- // padding: 6,
- // color,
- // background: "#fff",
+ // padding: 8,
+ // background: "#1e293b",
+ // color: "#fff",
+ // borderRadius: 4,
+ // fontSize: 14,
+ // minWidth: 120,
// }}
// >
- // <strong>Jobs Applied: {value}</strong>
+ // <div>
+ // <span style={{ color }}>{id}:</span>{" "}
+ // <strong>
+ // {value}
+ // {axisLeftLegend.includes("Hours") && "h"}
+ // </strong>
+ // </div>
// </div>
// )}
/>