Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak(datatrakWeb): RN-1374: Dashboard Metrics Updates #5864

Merged
merged 14 commits into from
Aug 30, 2024
Merged
Prev Previous commit
Next Next commit
updates
hrazasalman committed Aug 30, 2024

Verified

This commit was signed with the committer’s verified signature.
timryanb Tim Brooks
commit 87ff0e7d09164bd131fc4abfb9072c99c90b381d
20 changes: 15 additions & 5 deletions packages/datatrak-web-server/src/routes/TaskMetricsRoute.ts
Original file line number Diff line number Diff line change
@@ -26,8 +26,13 @@ export class TaskMetricsRoute extends Route<TaskMetricsRequest> {
const unassignedTasks = await models.task.count(
{
...baseQuery,
[QUERY_CONJUNCTIONS.RAW]: {
sql: `assignee_id IS NULL`,
status: {
comparator: 'NOT IN',
comparisonValue: [TaskStatus.completed, TaskStatus.cancelled],
},
assignee_id: {
comparator: 'IS',
comparisonValue: null,
},
},
baseJoin,
@@ -36,6 +41,10 @@ export class TaskMetricsRoute extends Route<TaskMetricsRequest> {
const overdueTasks = await models.task.count(
{
...baseQuery,
status: {
comparator: 'NOT IN',
comparisonValue: [TaskStatus.completed, TaskStatus.cancelled],
},
due_date: {
comparator: '<=',
comparisonValue: new Date().getTime(),
@@ -49,8 +58,9 @@ export class TaskMetricsRoute extends Route<TaskMetricsRequest> {
{
...baseQuery,
status: TaskStatus.completed,
[QUERY_CONJUNCTIONS.RAW]: {
sql: `repeat_schedule IS NULL`,
repeat_schedule: {
comparator: 'IS',
comparisonValue: null,
},
},
{
@@ -68,7 +78,7 @@ export class TaskMetricsRoute extends Route<TaskMetricsRequest> {
return new Date(formattedDate).getTime() <= record.due_date;
});

const onTimeCompletionRate = (completedTasks.length / onTimeCompletedTasks.length) * 100 || 0;
const onTimeCompletionRate = (onTimeCompletedTasks.length / completedTasks.length) * 100 || 0;

return {
unassignedTasks,
Original file line number Diff line number Diff line change
@@ -4,10 +4,11 @@ import styled from 'styled-components';

const MetricWrapper = styled.div`
display: flex;
border: 1px solid;
border: 1px solid #3f5539;
border-radius: 3px;
margin-inline: 0.5rem;
margin-block-end: auto;
min-width: 28%;
${({ theme }) => theme.breakpoints.down('xs')} {
width: inherit;
margin-block-start: 0.5rem;
@@ -37,7 +38,7 @@ const MetricText = styled.p`
font-weight: 500;
margin: 0;
${({ theme }) => theme.breakpoints.up('lg')} {
min-width: 12rem;
min-width: 16rem;
}
`;

Original file line number Diff line number Diff line change
@@ -5,11 +5,13 @@ import { useCurrentUserContext, useTaskMetrics } from '../../api';

const TaskMetricsContainer = styled.div`
margin-block-end: 0;
gap: 0.5rem;
gap: 0.2rem;
flex: 1;
${({ theme }) => theme.breakpoints.up('xs')} {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-left: 1rem;
}
${({ theme }) => theme.breakpoints.down('xs')} {
width: inherit;
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ const ContentWrapper = styled.div`
align-items: center;
justify-content: flex-end;
width: 100%;
flex: 1;
${({ theme }) => theme.breakpoints.down('xs')} {
padding-inline-start: 1rem;
flex-direction: column;