Skip to content

Commit 709132c

Browse files
Use stomach capacity to calculate food percentage in Citizen profile
1 parent 5f77e59 commit 709132c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/generated/graphql.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ export type GetCitizenQueryVariables = Exact<{
11021102
}>;
11031103

11041104

1105-
export type GetCitizenQuery = { __typename?: 'Query', citizen: { __typename: 'Citizen', id: string, name: string, bornOn: number, stomach: number, isHomeless: boolean } | { __typename: 'NotFound' } };
1105+
export type GetCitizenQuery = { __typename?: 'Query', citizen: { __typename: 'Citizen', id: string, name: string, bornOn: number, stomach: number, stomachCapacity: number, isHomeless: boolean } | { __typename: 'NotFound' } };
11061106

11071107
export type GetCitizensQueryVariables = Exact<{
11081108
input: CitizensFromIslandInput;
@@ -2054,6 +2054,7 @@ export const GetCitizenDocument = gql`
20542054
name
20552055
bornOn
20562056
stomach
2057+
stomachCapacity
20572058
isHomeless
20582059
}
20592060
}

src/pages/citizen/Citizen.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const CitizenPage = () => {
2323
name
2424
bornOn
2525
stomach
26+
stomachCapacity
2627
isHomeless
2728
}
2829
}
@@ -52,7 +53,11 @@ const CitizenPage = () => {
5253
<br />
5354
<b>Energy:</b> 100%
5455
<br />
55-
<b>Food:</b> {((data.citizen.stomach / 720) * 100).toFixed(0)}%
56+
<b>Food:</b>{' '}
57+
{((data.citizen.stomach / data.citizen.stomachCapacity) * 100).toFixed(
58+
0,
59+
)}
60+
%
5661
<br />
5762
<b>Happiness:</b> 100%
5863
<br />

0 commit comments

Comments
 (0)