diff --git a/app/graphql/types/demand_efforts_list_type.rb b/app/graphql/types/demand_efforts_list_type.rb new file mode 100644 index 000000000..38658550f --- /dev/null +++ b/app/graphql/types/demand_efforts_list_type.rb @@ -0,0 +1,6 @@ +module Types + class DemandEffortsListType < BaseObject + field :demand_efforts, [Types::DemandEffortType], null: true + field :demand_efforts_count, Int, null: true + end +end \ No newline at end of file diff --git a/app/graphql/types/teams/team_member_type.rb b/app/graphql/types/teams/team_member_type.rb index b6d3d09f7..ec89e7c34 100644 --- a/app/graphql/types/teams/team_member_type.rb +++ b/app/graphql/types/teams/team_member_type.rb @@ -19,6 +19,11 @@ class TeamMemberType < Types::BaseObject field :start_date, GraphQL::Types::ISO8601Date, null: true field :teams, [Types::Teams::TeamType], null: true field :user, Types::UserType, null: true + field :demand_efforts_list, Types::DemandEffortsListType, null: true do + argument :from_date, GraphQL::Types::ISO8601Date, required: false + argument :until_date, GraphQL::Types::ISO8601Date, required: false + argument :page_number, Integer, required: false + end field :demands, [Types::DemandType] do argument :limit, Int, required: false @@ -79,6 +84,12 @@ def demands(status: 'ALL', type: 'ALL', limit: nil) demands.limit(limit) end + def demand_efforts_list(from_date: nil, until_date: nil, page_number: nil) + efforts = object.demand_efforts.to_dates(from_date, until_date).order(start_time_to_computation: :desc) + efforts_paginated = efforts.page(page_number).per(10) + { 'demand_efforts_count' => efforts.count, 'demand_efforts' => efforts_paginated } + end + def projects_list(order_field:, sort_direction: 'ASC', per_page: 10, page_number: 1) projects = if sort_direction == 'DESC' object.projects.order("#{order_field} DESC") diff --git a/app/spa/src/components/TeamMemberDashboardTables.tsx b/app/spa/src/components/TeamMemberDashboardTables.tsx index 16a1b56fb..8953ddea2 100644 --- a/app/spa/src/components/TeamMemberDashboardTables.tsx +++ b/app/spa/src/components/TeamMemberDashboardTables.tsx @@ -130,7 +130,7 @@ const TeamMemberDashboardTables = ({ t("dashboard.latestEfforts.effortValue"), ] - const latestEffortsRows = teamMember?.demandEfforts?.map((effort) => [ + const latestEffortsRows = teamMember?.demandEffortsList?.demandEfforts?.map((effort) => [ diff --git a/app/spa/src/components/ui/DateLocale.tsx b/app/spa/src/components/ui/DateLocale.tsx index a1e9442c3..63b84d7e9 100644 --- a/app/spa/src/components/ui/DateLocale.tsx +++ b/app/spa/src/components/ui/DateLocale.tsx @@ -6,11 +6,10 @@ import { formatDate } from "../../lib/date" type DateLocaleProps = { date: string time?: boolean + isPtBr?: boolean } -const DateLocale = ({ date, time }: DateLocaleProps) => { - const { i18n } = useTranslation() - const isPtBr = i18n.language === "pt" +const DateLocale = ({ date, time, isPtBr = true}: DateLocaleProps) => { const dateFormat = isPtBr ? "dd/MM/yyyy" : "MM/dd/yyyy" const format = time ? `${dateFormat} HH:mm` : dateFormat diff --git a/app/spa/src/modules/teamMember/teamMember.types.ts b/app/spa/src/modules/teamMember/teamMember.types.ts index 5f78ff424..caded1b65 100644 --- a/app/spa/src/modules/teamMember/teamMember.types.ts +++ b/app/spa/src/modules/teamMember/teamMember.types.ts @@ -42,4 +42,8 @@ export type TeamMember = { yAxisProjectsNames: string[] } demandEfforts?: DemandEffort[] + demandEffortsList?: { + demandEfforts?: DemandEffort[] + demandEffortsCount?: number + } } diff --git a/app/spa/src/pages/TeamMembers/TeamMemberDashboard.tsx b/app/spa/src/pages/TeamMembers/TeamMemberDashboard.tsx index 0c867fb58..c10eb34e8 100644 --- a/app/spa/src/pages/TeamMembers/TeamMemberDashboard.tsx +++ b/app/spa/src/pages/TeamMembers/TeamMemberDashboard.tsx @@ -141,6 +141,34 @@ const TEAM_MEMBER_QUERY = gql` automaticUpdate membershipEffortPercentage } + demandEffortsList(fromDate: $fromDate, untilDate: $untilDate, pageNumber: $pageNumber) { + demandEfforts{ + id + effortValue + effortMoney + startTimeToComputation + finishTimeToComputation + stagePercentage + pairingPercentage + managementPercentage + totalBlocked + mainEffortInTransition + stage + who + team { + id + name + } + createdAt + updatedAt + demandId + demandExternalId + memberRole + automaticUpdate + membershipEffortPercentage + } + demandEffortsCount + } } } ` diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb index 0aebcc5c6..c65476ff7 100644 --- a/spec/graphql/types/query_type_spec.rb +++ b/spec/graphql/types/query_type_spec.rb @@ -1884,9 +1884,12 @@ xAxis yAxis } - demandEfforts(fromDate: "#{25.days.ago.iso8601}", untilDate: "#{15.days.ago.iso8601}"){ + demandEfforts(fromDate: "#{25.days.ago.iso8601}", untilDate: "#{15.days.ago.iso8601}", pageNumber: 1){ finishTimeToComputation } + demandEffortsList(fromDate: "#{25.days.ago.iso8601}", untilDate: "#{15.days.ago.iso8601}", pageNumber: 1){ + demandEffortsCount + } projectHoursData { xAxis yAxisProjectsNames @@ -2043,7 +2046,10 @@ 'memberThroughputData' => [0, 0, 0, 2], 'demandEfforts' => [{ 'finishTimeToComputation' => '2022-05-03T10:00:00-03:00' - }] + }], + 'demandEffortsList' => { + 'demandEffortsCount' => 1 + } }) end end