Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Archived Prices #350

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions datasources/historical-prices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class historicalPricesAPI extends WorkerKVSplit {
super('historical_price_data', dataSource);
this.addGameMode('pve');
this.defaultDays = 7;
this.maxDays = 7;
this.maxDays = 30;
this.itemLimitDays = 2;
}

Expand All @@ -27,9 +27,9 @@ class historicalPricesAPI extends WorkerKVSplit {
if (!prices) {
return [];
}
/*if (days === this.maxDays) {
if (days === this.maxDays) {
return prices;
}*/
}
const cutoffTimestamp = new Date().setDate(new Date().getDate() - days);
let dayFiltered = prices.filter(hp => hp.timestamp >= cutoffTimestamp);
if (halfResults) {
Expand Down
4 changes: 2 additions & 2 deletions resolvers/itemResolver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export default {
historicalItemPrices(obj, args, context, info) {
return context.util.paginate(context.data.worker.historicalPrice.getByItemId(context, info, args.id, args.days), args);
},
/*archivedItemPrices(obj, args, context, info) {
archivedItemPrices(obj, args, context, info) {
return context.util.paginate(context.data.worker.archivedPrice.getByItemId(context, info, args.id), args);
},*/
},
armorMaterials(obj, args, context, info) {
return context.data.worker.item.getArmorMaterials(context, info);
},
Expand Down
26 changes: 3 additions & 23 deletions schema-static.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,6 @@ type Ammo {
#attributes: AttributeCollection!
}

#type AttributeCollection {
# int: [AttributeInt]!
# float: [AttributeFloat]!
# string: [ItemAttribute]!
# boolean: [AttributeBoolean]!
#}

#type AttributeBoolean {
# name: String!
# value: Boolean!
#}

#type AttributeFloat {
# name: String!
# value: Float!
#}

#type AttributeInt {
# name: String!
# value: Int!
#}

type ArmorMaterial {
id: String
name: String
Expand Down Expand Up @@ -234,6 +212,8 @@ type HideoutStationLevel {
type historicalPricePoint {
price: Int
priceMin: Int
offerCount: Int
offerCountMin: Int
timestamp: String
}

Expand Down Expand Up @@ -1395,7 +1375,7 @@ interface Vendor {
type Query {
achievements(lang: LanguageCode, limit: Int, offset: Int): [Achievement]!
ammo(lang: LanguageCode, gameMode: GameMode, limit: Int, offset: Int): [Ammo]
#archivedItemPrices(id: ID!, limit: Int, offset: Int): [historicalPricePoint]!
archivedItemPrices(id: ID!, limit: Int, offset: Int): [historicalPricePoint]!
barters(lang: LanguageCode, gameMode: GameMode, limit: Int, offset: Int): [Barter]
bosses(lang: LanguageCode, gameMode: GameMode, name: [String!], limit: Int, offset: Int): [MobInfo]
crafts(lang: LanguageCode, gameMode: GameMode, limit: Int, offset: Int): [Craft]
Expand Down
Loading