You've already forked AstralRinth
forked from didirus/AstralRinth
refactor(knossos): Rewrite date range system on analytics dashboard. (#1301)
* Start work on refactoring date range system. * Use timeResolution terminology. * "Last month" initial default. * Migrate fully to dayjs - ease of use. * Discard changes to pnpm-lock.yaml * utilize getter * Fix date label in ChartDisplay.vue * Finish cleanup * Update STAGING_API_URL in nuxt.config.ts * Lint fixes * Refactor ChartDisplay.vue to handle loading state in selectedRange and formattedCategorySubtitle * Remove modal impl --------- Signed-off-by: Calum H. <contact@mineblock11.dev> Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -304,13 +304,10 @@ export const useFetchAllAnalytics = (
|
||||
projects,
|
||||
selectedProjects,
|
||||
personalRevenue = false,
|
||||
startDate = ref(dayjs().subtract(30, "days")),
|
||||
endDate = ref(dayjs()),
|
||||
timeResolution = ref(1440),
|
||||
) => {
|
||||
const timeResolution = ref(1440); // 1 day
|
||||
const timeRange = ref(43200); // 30 days
|
||||
|
||||
const startDate = ref(Date.now() - timeRange.value * 60 * 1000);
|
||||
const endDate = ref(Date.now());
|
||||
|
||||
const downloadData = ref(null);
|
||||
const viewData = ref(null);
|
||||
const revenueData = ref(null);
|
||||
@@ -394,8 +391,8 @@ export const useFetchAllAnalytics = (
|
||||
[() => startDate.value, () => endDate.value, () => timeResolution.value, () => projects.value],
|
||||
async () => {
|
||||
const q = {
|
||||
start_date: dayjs(startDate.value).toISOString(),
|
||||
end_date: dayjs(endDate.value).toISOString(),
|
||||
start_date: startDate.value.toISOString(),
|
||||
end_date: endDate.value.toISOString(),
|
||||
resolution_minutes: timeResolution.value,
|
||||
};
|
||||
|
||||
@@ -442,7 +439,6 @@ export const useFetchAllAnalytics = (
|
||||
return {
|
||||
// Configuration
|
||||
timeResolution,
|
||||
timeRange,
|
||||
|
||||
startDate,
|
||||
endDate,
|
||||
|
||||
Reference in New Issue
Block a user