GGREOYIRZE2GH62X7YXQA7IUSSB25ENLQ5OKVJYWPNI462DP37FAC
3QZU4ZIBA24ZXKPBGMTWX4S2GF6AOXJMPD2753CCTU7QUL2WMDXAC
B7W4Q522DLB6DKH2TFDOCTSZFZLFTOLCT6CCZEOC3V3UUMSAOOFAC
N7TZV5WJKLYKSG6SIVAID4ZCC76YHZU5U5WWQGG6TFKAV6CE3Y6AC
HXRDRHIVGSBEAMTKJFZK43MSB53BKON6F77AARUQNWFUPSTZSBPAC
Q4BYGYNX3UZXX47EMX2GWX6M6ICSMIMCLQ7HVOYS4HB4RHYI4NEQC
62OPHDLT2IIHK2OEH76NWB6V7E2Z5USUBNHB4X3DP2XLDI3YHY7QC
EKERBH2GMXCDZSFXAQP6FGGQTTW3ZENOUM4ZKZVHWAAKGW64YLTAC
.send()
.await?
.json()
.await
.map_err(anyhow::Error::from)
}
pub async fn lookup_guild_by_id(
client: &Client,
token: &WclToken,
id: i64,
) -> Result<Response<guild_by_id::ResponseData>> {
client
.post(WCL_ENDPOINT)
.bearer_auth(&token.access_token)
.json(&GuildById::build_query(guild_by_id::Variables { id }))
.values(&NewTeam {
id: guild.id as i32,
tag: false,
name: guild.name.clone(),
server_slug: guild.server.slug.clone(),
region_slug: guild.server.region.slug.clone(),
tag_name: None,
})
.on_conflict_do_nothing()
.values(&value)
.on_conflict((dsl::id, dsl::tag))
.do_update()
.set((
dsl::name.eq(excluded(dsl::name)),
dsl::server_slug.eq(excluded(dsl::server_slug)),
dsl::region_slug.eq(excluded(dsl::region_slug)),
))
.on_conflict_do_nothing()
.on_conflict((dsl::id, dsl::tag))
.do_update()
.set((
dsl::name.eq(excluded(dsl::name)),
dsl::server_slug.eq(excluded(dsl::server_slug)),
dsl::region_slug.eq(excluded(dsl::region_slug)),
dsl::tag_name.eq(excluded(dsl::tag_name)),
))
background_import(
client.clone(),
token.clone(),
con,
tx,
guild,
server_slug,
region_slug,
tag,
zone,
)
.inspect_err(|e| {
error!("an error occurred during import: {:?}", e);
}),
background_import(client.clone(), token.clone(), con, tx, guild_id, tag, zone)
.inspect_err(|e| {
error!("an error occurred during import: {:?}", e);
}),
query GuildById($id: Int!) {
guildData {
guild(id: $id) {
id,
name,
server { name, region { slug }, slug },
tags {
id, name
}
}
}
}
import { useParams } from 'react-router-dom';
import { gql, useSubscription } from '@apollo/client';
import { read_id, Params } from './Details';
const SYNC_SUB = gql`
subscription SyncGuild($guild: String!, $server: String!, $region: String!, $zone: Int!, $tag: Int) {
sync(guild: $guild, serverSlug: $server, regionSlug: $region, zone: $zone, tag: $tag) {
kind, totalLogs, remainingLogs
}
}
`;
export default function SyncTest() {
const { region, server, guild, tag, zone } = useParams<Params>();
const { loading, data, error } = useSubscription(SYNC_SUB, {
variables: { region, server, guild, tag: read_id(tag), zone: read_id(zone) }
});
console.log(loading, data, error);
if (data !== undefined) {
return (
<div>
<div className="h-3 relative max-w-xl rounded-full overflow-hidden">
<div className="w-full h-full bg-gray-200 absolute"></div>
<div className="h-full bg-blue-500 absolute" style={{ width: `${(1 - data.sync.remainingLogs / data.sync.totalLogs) * 100}%` }}></div>
</div>
</div>
);
} else {
return <div></div>;
}
}
import { useEffect } from 'react';
import { gql, useSubscription } from '@apollo/client';
const SYNC_SUB = gql`
subscription SyncGuild($id: Int!, $tag: Int, $zone: Int!) {
sync(guildId: $id, tag: $tag, zone: $zone) {
kind, totalLogs, remainingLogs
}
}
`;
export default function Sync({ syncCallback, id, tag, zone }: { id: number; syncCallback: () => void; tag?: number; zone: number; }) {
const { data } = useSubscription(SYNC_SUB, {
variables: { id, tag, zone }
});
useEffect(() => {
if (data && data.sync.kind === 'COMPLETE') {
syncCallback();
}
}, [data, syncCallback]);
if (data !== undefined) {
return (
<div className="m-auto mt-10 max-w-xl">
<div className="h-3 relative max-w-xl rounded-full overflow-hidden">
<div className="w-full h-full bg-gray-200 absolute"></div>
<div className="h-full bg-blue-500 absolute" style={{ width: `${(1 - data.sync.remainingLogs / data.sync.totalLogs) * 100}%` }}></div>
</div>
</div>
);
} else {
return <div></div>;
}
}
<div><a href={`https://www.warcraftlogs.com/reports/${code}/`}>{formatDate(startTime)} ({fights.length} Pulls)</a></div>
<div className="ml-1 border-b border-gray-200 w-min whitespace-nowrap"><a href={`https://www.warcraftlogs.com/reports/${code}/`}>{formatDate(startTime)}</a></div>
}
function url_for(data: any, tier: string): string {
return `/details/${data.guild.regionSlug.toLowerCase()}/${data.guild.serverSlug}/${data.guild.id}-${slugify(data.guild.name)}/${data.team ? `${data.team.id}-${slugify(data.team.tagName)}` : 'all'}/${tier}`;
const { region, server, guild, tag, zone } = useParams<Params>();
const params = useParams<Params>();
const location = useLocation();
const { region, server, guild, tag, zone } = params;
const [syncComplete, setSyncComplete] = useState(false);
if (error) {
return <div>An error occurred while fetching data: {error.message}</div>;
if(!guildid || (!tagid && tag !== 'all') || !tier) {
return <Redirect to='/' />;
}
if(data.guild) {
const url = url_for(data, zone);
if (location.pathname !== url) {
return <Redirect to={url} />;
}
const team = data.tag || data.guild;
const team = data.team || data.guild;
let content;
if(!syncComplete) {
content = <Sync syncCallback={() => setSyncComplete(true)} id={guildid} tag={tagid} zone={tier} />;
} else {
content = (encounters && team.id) ? encounters.map(encounter => <EncounterOverview key={encounter} encounterId={encounter} difficulty={5} team={team.id} region={toRegion(region)}/>) : <div>No tier selected.</div>
}