Renamed player columns to be consistent snake_case (#262)

This commit is contained in:
Alec LaLonde
2021-01-06 22:08:58 -07:00
committed by GitHub
parent 1027f019e5
commit 5534ff1a45
17 changed files with 119 additions and 134 deletions

View File

@@ -82,7 +82,7 @@ export const PlayerTile: React.FC<Props> = ({ player }) => (
{player.rank}
</MetaTag>
)}
<MetaTag size="md">XP: {Math.floor(player.totalXp)}</MetaTag>
<MetaTag size="md">XP: {Math.floor(player.total_xp)}</MetaTag>
</Wrap>
{player.box_profile?.description ? (
<VStack spacing={2} align="stretch">

View File

@@ -49,7 +49,7 @@ export const PlayerMemberships: React.FC<Props> = ({
}
{(player.rank || '').toLowerCase()}
</Text>
<Text fontSize="xs">XP: {Math.round(player.totalXp || 0)}</Text>
<Text fontSize="xs">XP: {Math.round(player.total_xp || 0)}</Text>
</HStack>
</Box>
</HStack>

View File

@@ -36,7 +36,7 @@ export const SetupPlayerType: React.FC = () => {
playerId: user.id,
input: {
enneagram: personalityType?.name,
playerTypeId: playerType?.id,
player_type_id: playerType?.id,
},
});

View File

@@ -58,8 +58,8 @@ export const SetupProfile: React.FC = () => {
})),
);
}
if (player.tz && !timeZone) {
setTimeZone(player.tz);
if (player.timezone && !timeZone) {
setTimeZone(player.timezone);
}
}
}, [

View File

@@ -28,7 +28,7 @@ export const SetupTimeZone: React.FC = () => {
const { error } = await updateProfile({
playerId: user.id,
input: {
tz: timeZone
timezone: timeZone
}
});

View File

@@ -4,11 +4,11 @@ export const PlayerFragment = gql`
fragment PlayerFragment on player {
id
username
totalXp
total_xp
rank
ethereum_address
availability_hours
tz
timezone
EnneagramType {
description
name

View File

@@ -6,7 +6,7 @@ import { PlayerFragment } from './fragments';
const playersQuery = gql`
query GetPlayers($limit: Int) {
player(order_by: { totalXp: desc }, limit: $limit) {
player(order_by: { total_xp: desc }, limit: $limit) {
...PlayerFragment
}
}

View File

@@ -5,7 +5,8 @@ export const UpdateProfileMutation = gql`
update_player_by_pk(pk_columns: { id: $playerId }, _set: $input) {
id
availability_hours
tz
timezone
}
}
`;

View File

@@ -10,9 +10,9 @@ export interface TimeZoneDisplay {
export const getPlayerTimeZoneDisplay = (player: PlayerFragmentFragment): TimeZoneDisplay => {
let tzLabel;
let offsetLabel;
if (player?.tz) {
const timeZone = spacetime.now().goto(player.tz)
const tzDisplay = display(player.tz)
if (player?.timezone) {
const timeZone = spacetime.now().goto(player.timezone)
const tzDisplay = display(player.timezone)
if (tzDisplay && tzDisplay.daylight && tzDisplay.standard) {
tzLabel = timeZone.isDST()
? tzDisplay.daylight.abbrev
@@ -24,7 +24,7 @@ export const getPlayerTimeZoneDisplay = (player: PlayerFragmentFragment): TimeZo
offsetLabel = `(GMT ${offset})`;
}
} else {
tzLabel = player.tz;
tzLabel = player.timezone;
}
}