Skip to content

Commit

Permalink
fix: fixed demand efforts filter
Browse files Browse the repository at this point in the history
  • Loading branch information
celsoMartins committed Sep 30, 2023
1 parent 44de4dc commit af7e801
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 146 deletions.
2 changes: 1 addition & 1 deletion app/graphql/types/teams/team_member_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TeamMemberType < Types::BaseObject
field :project_hours_data, Types::Charts::ProjectHoursChartDataType, null: true

def demand_efforts(from_date: nil, until_date: nil)
object.demand_efforts.to_dates(from_date, until_date)
object.demand_efforts.to_dates(from_date, until_date).order(start_time_to_computation: :desc)
end

def demands(status: 'ALL', type: 'ALL', limit: nil)
Expand Down
2 changes: 1 addition & 1 deletion app/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"__tests__"
],
"rules": {
"no-console": "error",
"no-console": "warn",
"max-len": [
"error",
{
Expand Down
41 changes: 21 additions & 20 deletions app/spa/src/components/TeamMemberDashboardTables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,30 @@ const TeamMemberDashboardTables = ({
const latestEffortsHeader = [
t("dashboard.latestEfforts.name"),
t("dashboard.latestEfforts.team"),
t("dashboard.latestEfforts.effortDate"),
t("dashboard.latestEfforts.start"),
t("dashboard.latestEfforts.end"),
t("dashboard.latestEfforts.demands"),
t("dashboard.latestEfforts.effortValue"),
]

const latestEffortsRows =
teamMember?.demandEfforts?.map((effort) => [
`${effort.who || ""}`,
<Link
component={RouterLink}
to={`/companies/taller/teams/${effort.team?.id}`}
>
{effort.team?.name}
</Link>,
<DateLocale date={String(effort.updatedAt)} />,
<Link
component={RouterLink}
to={`/companies/taller/demands/${effort.demandExternalId}`}
>
{effort.demandExternalId}
</Link>,
`${effort.effortValue || ""}`,
]) || []
const latestEffortsRows = teamMember?.demandEfforts?.map((effort) => [
`${effort.who || ""}`,
<Link
component={RouterLink}
to={`/companies/taller/teams/${effort.team?.id}`}
>
{effort.team?.name}
</Link>,
<DateLocale time date={String(effort.startTimeToComputation)} />,
<DateLocale time date={String(effort.finishTimeToComputation)} />,
<Link
component={RouterLink}
to={`/companies/taller/demands/${effort.demandExternalId}`}
>
{effort.demandExternalId}
</Link>,
`${(effort.effortValue || 0).toFixed(2)}`,
])

const latestProjectsRows =
teamMember.projectsList?.projects?.map((project) => [
Expand Down Expand Up @@ -232,7 +233,7 @@ const TeamMemberDashboardTables = ({
<Table
title={t("dashboard.latestEfforts.title")}
headerCells={latestEffortsHeader}
rows={latestEffortsRows}
rows={latestEffortsRows || []}
/>
</Grid>
</Grid>
Expand Down
3 changes: 2 additions & 1 deletion app/spa/src/locales/coca/teamMembers.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"title": "Latest Efforts",
"name": "Name",
"team": "Team",
"effortDate": "Effort date",
"start": "Start",
"end": "End",
"demands": "Demands",
"effortValue": "Effort Value",
"untilDate": "End Date",
Expand Down
3 changes: 2 additions & 1 deletion app/spa/src/locales/en/teamMembers.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"title": "Latest Efforts",
"name": "Name",
"team": "Team",
"effortDate": "Effort date",
"start": "Start",
"end": "End",
"demands": "Demands",
"effortValue": "Effort Value",
"untilDate": "End Date",
Expand Down
3 changes: 2 additions & 1 deletion app/spa/src/locales/pt/teamMembers.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"title": "Últimos Esforços",
"name": "Nome",
"team": "Time",
"effortDate": "Data do esforço",
"start": "Início",
"end": "Fim",
"demands": "Demandas",
"effortValue": "Valor do esforço",
"untilDate": "Data final",
Expand Down
Loading

0 comments on commit af7e801

Please sign in to comment.