fix: use 1-based indexing for clan ranks for versions before U24
All checks were successful
Build / build (pull_request) Successful in 1m8s
All checks were successful
Build / build (pull_request) Successful in 1m8s
This commit is contained in:
parent
66d3057d40
commit
410921d800
@ -22,7 +22,7 @@ import type {
|
|||||||
ITechProjectDatabase
|
ITechProjectDatabase
|
||||||
} from "../types/guildTypes.ts";
|
} from "../types/guildTypes.ts";
|
||||||
import { GuildPermission } from "../types/guildTypes.ts";
|
import { GuildPermission } from "../types/guildTypes.ts";
|
||||||
import { toMongoDate, toOid, toOid2 } from "../helpers/inventoryHelpers.ts";
|
import { toMongoDate, toOid, toOid2, version_compare } from "../helpers/inventoryHelpers.ts";
|
||||||
import type { Types } from "mongoose";
|
import type { Types } from "mongoose";
|
||||||
import type { IDojoBuild, IDojoResearch } from "warframe-public-export-plus";
|
import type { IDojoBuild, IDojoResearch } from "warframe-public-export-plus";
|
||||||
import { ExportDojoRecipes, ExportResources } from "warframe-public-export-plus";
|
import { ExportDojoRecipes, ExportResources } from "warframe-public-export-plus";
|
||||||
@ -68,9 +68,15 @@ export const getGuildClient = async (
|
|||||||
let missingEntry = true;
|
let missingEntry = true;
|
||||||
const dataFillInPromises: Promise<void>[] = [];
|
const dataFillInPromises: Promise<void>[] = [];
|
||||||
for (const guildMember of guildMembers) {
|
for (const guildMember of guildMembers) {
|
||||||
|
// Use 1-based indexing for clan ranks for versions before U24. In my testing, 2018.06.14.23.21 and below used 1-based indexing and 2019.04.04.21.31 and above used 0-based indexing. I didn't narrow it down further, but I think U24 is a good spot for them to have changed it.
|
||||||
|
let rankBase = 0;
|
||||||
|
if (account.BuildLabel && version_compare(account.BuildLabel, "2018.11.08.14.45") < 0) {
|
||||||
|
rankBase += 1;
|
||||||
|
}
|
||||||
|
|
||||||
const member: IGuildMemberClient = {
|
const member: IGuildMemberClient = {
|
||||||
_id: toOid2(guildMember.accountId, account.BuildLabel),
|
_id: toOid2(guildMember.accountId, account.BuildLabel),
|
||||||
Rank: guildMember.rank,
|
Rank: guildMember.rank + rankBase,
|
||||||
Status: guildMember.status,
|
Status: guildMember.status,
|
||||||
Note: guildMember.RequestMsg,
|
Note: guildMember.RequestMsg,
|
||||||
RequestExpiry: guildMember.RequestExpiry ? toMongoDate(guildMember.RequestExpiry) : undefined
|
RequestExpiry: guildMember.RequestExpiry ? toMongoDate(guildMember.RequestExpiry) : undefined
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user