1.0.0
This commit is contained in:
@@ -19,7 +19,6 @@ const userOrgs = await db.select({
|
||||
.where(eq(members.userId, user.id))
|
||||
.all();
|
||||
|
||||
// Get stats for first organization
|
||||
const firstOrg = userOrgs[0];
|
||||
let stats = {
|
||||
totalTimeThisWeek: 0,
|
||||
@@ -30,12 +29,10 @@ let stats = {
|
||||
};
|
||||
|
||||
if (firstOrg) {
|
||||
// Calculate date ranges
|
||||
const now = new Date();
|
||||
const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
|
||||
const monthAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
||||
|
||||
// Get time entries for this week
|
||||
const weekEntries = await db.select()
|
||||
.from(timeEntries)
|
||||
.where(and(
|
||||
@@ -51,7 +48,6 @@ if (firstOrg) {
|
||||
return sum;
|
||||
}, 0);
|
||||
|
||||
// Get time entries for this month
|
||||
const monthEntries = await db.select()
|
||||
.from(timeEntries)
|
||||
.where(and(
|
||||
@@ -67,7 +63,6 @@ if (firstOrg) {
|
||||
return sum;
|
||||
}, 0);
|
||||
|
||||
// Count active timers
|
||||
const activeCount = await db.select()
|
||||
.from(timeEntries)
|
||||
.where(and(
|
||||
@@ -78,7 +73,6 @@ if (firstOrg) {
|
||||
|
||||
stats.activeTimers = activeCount.length;
|
||||
|
||||
// Count clients
|
||||
const clientCount = await db.select()
|
||||
.from(clients)
|
||||
.where(eq(clients.organizationId, firstOrg.organizationId))
|
||||
@@ -86,7 +80,6 @@ if (firstOrg) {
|
||||
|
||||
stats.totalClients = clientCount.length;
|
||||
|
||||
// Get recent entries
|
||||
stats.recentEntries = await db.select({
|
||||
entry: timeEntries,
|
||||
client: clients,
|
||||
|
||||
Reference in New Issue
Block a user