parent
472d9ab92f
commit
147901540a
@ -1,43 +1,52 @@
|
||||
import { useQuery } from "react-query";
|
||||
import { TStatGetParams, statController } from "../../API/LayoutApi/statistic";
|
||||
|
||||
export const useStatsData = ({search, team, start_date, end_date}: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/all-users/`, search, team, start_date, end_date],
|
||||
() => statController.read({search, team, start_date, end_date}),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
export const useStatsData = ({
|
||||
search,
|
||||
team,
|
||||
start_date,
|
||||
end_date,
|
||||
for_salary,
|
||||
}: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/all-users/`, search, team, start_date, end_date, for_salary],
|
||||
() =>
|
||||
statController.read({ search, team, start_date, end_date, for_salary }),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
};
|
||||
export const useStatTeamData = ({search, start_date, end_date}: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/all-teams/`, search, start_date, end_date],
|
||||
() => statController.team({search, start_date, end_date}),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
export const useStatTeamData = ({
|
||||
search,
|
||||
start_date,
|
||||
end_date,
|
||||
}: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/all-teams/`, search, start_date, end_date],
|
||||
() => statController.team({ search, start_date, end_date }),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
};
|
||||
|
||||
export const useCreatorsData = ({ start_date, end_date}: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/task-creators/`, start_date, end_date],
|
||||
() => statController.creators({ start_date, end_date}),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
export const useCreatorsData = ({ start_date, end_date }: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/task-creators/`, start_date, end_date],
|
||||
() => statController.creators({ start_date, end_date }),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
};
|
||||
|
||||
export const useCardData = ({ start_date, end_date}: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/tasks-comparison/`, start_date, end_date],
|
||||
() => statController.cards({ start_date, end_date}),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
export const useCardData = ({ start_date, end_date }: TStatGetParams) => {
|
||||
return useQuery(
|
||||
[`stats/tasks-comparison/`, start_date, end_date],
|
||||
() => statController.cards({ start_date, end_date }),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
};
|
||||
|
||||
export const useStatOne = (
|
||||
statId: number | string | undefined
|
||||
): any => {
|
||||
return useQuery(
|
||||
[`stat/${statId || "all"}`, statId],
|
||||
() => statController.statOne(statId),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
export const useStatOne = (statId: number | string | undefined): any => {
|
||||
return useQuery(
|
||||
[`stat/${statId || "all"}`, statId],
|
||||
() => statController.statOne(statId),
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
};
|
||||
|
@ -1,21 +1,22 @@
|
||||
export type TStat = {
|
||||
id: number;
|
||||
full_name: string;
|
||||
username: string;
|
||||
team_id: number | null;
|
||||
total_points: number;
|
||||
}
|
||||
id: number;
|
||||
full_name: string;
|
||||
username: string;
|
||||
team_id: number | null;
|
||||
total_points: number;
|
||||
for_salary: boolean;
|
||||
};
|
||||
export type TStatTeam = {
|
||||
id: number;
|
||||
name: string;
|
||||
is_active: boolean;
|
||||
total_points: number;
|
||||
}
|
||||
id: number;
|
||||
name: string;
|
||||
is_active: boolean;
|
||||
total_points: number;
|
||||
};
|
||||
|
||||
export type TCard = {
|
||||
all_tasks: number;
|
||||
active_tasks: number;
|
||||
active_tasks_percentage: number;
|
||||
inactive_tasks: number;
|
||||
inactive_tasks_percentage: number;
|
||||
}
|
||||
export type TCard = {
|
||||
all_tasks: number;
|
||||
active_tasks: number;
|
||||
active_tasks_percentage: number;
|
||||
inactive_tasks: number;
|
||||
inactive_tasks_percentage: number;
|
||||
};
|
||||
|
Loading…
Reference in new issue