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

@@ -54,13 +54,13 @@ export const UpdatePlayer = gql`
_or: [
{
ethereum_address: { _eq: $ethAddress }
scIdentityId: { _eq: $identityId }
sc_identity_id: { _eq: $identityId }
}
{
ethereum_address: { _eq: $ethAddress }
username: { _eq: $username }
}
{ scIdentityId: { _eq: $identityId } }
{ sc_identity_id: { _eq: $identityId } }
{
Accounts: {
_and: { type: { _eq: DISCORD }, identifier: { _eq: $discordId } }
@@ -70,17 +70,17 @@ export const UpdatePlayer = gql`
}
_set: {
ethereum_address: $ethAddress
scIdentityId: $identityId
sc_identity_id: $identityId
username: $username
rank: $rank
totalXp: $totalXp
total_xp: $totalXp
}
) {
affected_rows
returning {
id
ethereum_address
scIdentityId
sc_identity_id
username
}
}

View File

@@ -3,6 +3,6 @@ import gql from 'graphql-tag';
export const Player = gql`
fragment Player on player {
id
totalXp
total_xp
}
`;

View File

@@ -2499,13 +2499,12 @@ type player {
"""An object relationship"""
playerType: player_type
playerTypeId: Int
player_type_id: Int
rank: PlayerRank_enum
role: String
scIdentityId: String
timezone: Int
totalXp: numeric
tz: String
sc_identity_id: String
timezone: String
total_xp: numeric
updated_at: timestamptz
username: String!
}
@@ -2742,9 +2741,8 @@ input player_arr_rel_insert_input {
"""aggregate avg on columns"""
type player_avg_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -2752,9 +2750,8 @@ order by avg() on columns of table "player"
"""
input player_avg_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""
@@ -2774,13 +2771,12 @@ input player_bool_exp {
guilds: guild_player_bool_exp
id: uuid_comparison_exp
playerType: player_type_bool_exp
playerTypeId: Int_comparison_exp
player_type_id: Int_comparison_exp
rank: PlayerRank_enum_comparison_exp
role: String_comparison_exp
scIdentityId: String_comparison_exp
timezone: Int_comparison_exp
totalXp: numeric_comparison_exp
tz: String_comparison_exp
sc_identity_id: String_comparison_exp
timezone: String_comparison_exp
total_xp: numeric_comparison_exp
updated_at: timestamptz_comparison_exp
username: String_comparison_exp
}
@@ -2807,9 +2803,8 @@ input type for incrementing integer column in table "player"
"""
input player_inc_input {
availability_hours: Int
playerTypeId: Int
timezone: Int
totalXp: numeric
player_type_id: Int
total_xp: numeric
}
"""
@@ -2826,13 +2821,12 @@ input player_insert_input {
guilds: guild_player_arr_rel_insert_input
id: uuid
playerType: player_type_obj_rel_insert_input
playerTypeId: Int
player_type_id: Int
rank: PlayerRank_enum
role: String
scIdentityId: String
timezone: Int
totalXp: numeric
tz: String
sc_identity_id: String
timezone: String
total_xp: numeric
updated_at: timestamptz
username: String
}
@@ -2843,12 +2837,11 @@ type player_max_fields {
created_at: timestamptz
ethereum_address: String
id: uuid
playerTypeId: Int
player_type_id: Int
role: String
scIdentityId: String
timezone: Int
totalXp: numeric
tz: String
sc_identity_id: String
timezone: String
total_xp: numeric
updated_at: timestamptz
username: String
}
@@ -2861,12 +2854,11 @@ input player_max_order_by {
created_at: order_by
ethereum_address: order_by
id: order_by
playerTypeId: order_by
player_type_id: order_by
role: order_by
scIdentityId: order_by
sc_identity_id: order_by
timezone: order_by
totalXp: order_by
tz: order_by
total_xp: order_by
updated_at: order_by
username: order_by
}
@@ -2877,12 +2869,11 @@ type player_min_fields {
created_at: timestamptz
ethereum_address: String
id: uuid
playerTypeId: Int
player_type_id: Int
role: String
scIdentityId: String
timezone: Int
totalXp: numeric
tz: String
sc_identity_id: String
timezone: String
total_xp: numeric
updated_at: timestamptz
username: String
}
@@ -2895,12 +2886,11 @@ input player_min_order_by {
created_at: order_by
ethereum_address: order_by
id: order_by
playerTypeId: order_by
player_type_id: order_by
role: order_by
scIdentityId: order_by
sc_identity_id: order_by
timezone: order_by
totalXp: order_by
tz: order_by
total_xp: order_by
updated_at: order_by
username: order_by
}
@@ -2947,13 +2937,12 @@ input player_order_by {
guilds_aggregate: guild_player_aggregate_order_by
id: order_by
playerType: player_type_order_by
playerTypeId: order_by
player_type_id: order_by
rank: order_by
role: order_by
scIdentityId: order_by
sc_identity_id: order_by
timezone: order_by
totalXp: order_by
tz: order_by
total_xp: order_by
updated_at: order_by
username: order_by
}
@@ -2985,7 +2974,7 @@ enum player_select_column {
id
"""column name"""
playerTypeId
player_type_id
"""column name"""
rank
@@ -2994,16 +2983,13 @@ enum player_select_column {
role
"""column name"""
scIdentityId
sc_identity_id
"""column name"""
timezone
"""column name"""
totalXp
"""column name"""
tz
total_xp
"""column name"""
updated_at
@@ -3021,13 +3007,12 @@ input player_set_input {
enneagram: EnneagramType_enum
ethereum_address: String
id: uuid
playerTypeId: Int
player_type_id: Int
rank: PlayerRank_enum
role: String
scIdentityId: String
timezone: Int
totalXp: numeric
tz: String
sc_identity_id: String
timezone: String
total_xp: numeric
updated_at: timestamptz
username: String
}
@@ -3211,9 +3196,8 @@ enum player_skill_update_column {
"""aggregate stddev on columns"""
type player_stddev_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -3221,17 +3205,15 @@ order by stddev() on columns of table "player"
"""
input player_stddev_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""aggregate stddev_pop on columns"""
type player_stddev_pop_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -3239,17 +3221,15 @@ order by stddev_pop() on columns of table "player"
"""
input player_stddev_pop_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""aggregate stddev_samp on columns"""
type player_stddev_samp_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -3257,17 +3237,15 @@ order by stddev_samp() on columns of table "player"
"""
input player_stddev_samp_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""aggregate sum on columns"""
type player_sum_fields {
availability_hours: Int
playerTypeId: Int
timezone: Int
totalXp: numeric
player_type_id: Int
total_xp: numeric
}
"""
@@ -3275,9 +3253,8 @@ order by sum() on columns of table "player"
"""
input player_sum_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""
@@ -3622,7 +3599,7 @@ enum player_update_column {
id
"""column name"""
playerTypeId
player_type_id
"""column name"""
rank
@@ -3631,16 +3608,13 @@ enum player_update_column {
role
"""column name"""
scIdentityId
sc_identity_id
"""column name"""
timezone
"""column name"""
totalXp
"""column name"""
tz
total_xp
"""column name"""
updated_at
@@ -3652,9 +3626,8 @@ enum player_update_column {
"""aggregate var_pop on columns"""
type player_var_pop_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -3662,17 +3635,15 @@ order by var_pop() on columns of table "player"
"""
input player_var_pop_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""aggregate var_samp on columns"""
type player_var_samp_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -3680,17 +3651,15 @@ order by var_samp() on columns of table "player"
"""
input player_var_samp_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""aggregate variance on columns"""
type player_variance_fields {
availability_hours: Float
playerTypeId: Float
timezone: Float
totalXp: Float
player_type_id: Float
total_xp: Float
}
"""
@@ -3698,9 +3667,8 @@ order by variance() on columns of table "player"
"""
input player_variance_order_by {
availability_hours: order_by
playerTypeId: order_by
timezone: order_by
totalXp: order_by
player_type_id: order_by
total_xp: order_by
}
"""

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;
}
}