Skip to content

Commit

Permalink
Merge pull request #30 from ElemarJR/main
Browse files Browse the repository at this point in the history
Fixing filters on the performance analysis and improving the search
  • Loading branch information
ElemarJR authored Nov 6, 2024
2 parents cbe7e94 + 35760bd commit bde1eb0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/src/models/analytics/performance_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def calculate_entity_summary(regular_cases: List[OneWeekRegularCasePerformanceSu

case_summaries = [calculate_case_metrics(case, by_case_hours.get(case.id, 0), by_case_month_hours.get(case.id, 0))
for case in cases
if (case.weekly_approved_hours and case.weekly_approved_hours > 0) or
if (case.is_active and case.weekly_approved_hours and case.weekly_approved_hours > 0) or
(by_case_hours.get(case.id, 0) > 0)]

regular_cases = [case for case in case_summaries if isinstance(case, OneWeekRegularCasePerformanceSummary)]
Expand Down
31 changes: 30 additions & 1 deletion frontend/src/app/components/OmniCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { Button } from "@/components/ui/button"
import { MagnifyingGlassIcon } from "@radix-ui/react-icons"
import { useQuery, gql } from "@apollo/client"
import { UserIcon, BriefcaseIcon, UsersIcon, HandshakeIcon } from "lucide-react"
import { UserIcon, BriefcaseIcon, UsersIcon, HandshakeIcon, TrophyIcon } from "lucide-react"

const GET_CONSULTANTS = gql`
query GetConsultants {
Expand All @@ -38,6 +38,13 @@ const GET_CONSULTANTS = gql`
slug
name
}
cases(onlyActives: true) {
slug
title
tracker {
name
}
}
}
`

Expand Down Expand Up @@ -176,6 +183,28 @@ export function OmniCommands({ open, setOpen }: OmniCommandsProps) {
</CommandItem>
))}
</CommandGroup>

<CommandGroup heading="Cases">
{data?.cases.map((caseItem: { slug: string, title: string, tracker: { name: string }[] }) => (
<React.Fragment key={caseItem.slug}>
<CommandItem
onSelect={() => runCommand(() => router.push(`/about-us/cases/${caseItem.slug}`))}
>
<TrophyIcon className="mr-2 h-4 w-4" />
{caseItem.title}
</CommandItem>
{caseItem.tracker?.map((tracker, index) => (
<CommandItem
key={`${caseItem.slug}-${index}`}
onSelect={() => runCommand(() => router.push(`/about-us/cases/${caseItem.slug}`))}
>
<TrophyIcon className="mr-2 h-4 w-4" />
{tracker.name}
</CommandItem>
))}
</React.Fragment>
))}
</CommandGroup>
</CommandList>
</CommandDialog>
)
Expand Down

0 comments on commit bde1eb0

Please sign in to comment.