Skip to content

Commit

Permalink
fix(index.vue): update queries to filter out prices with trade_type -…
Browse files Browse the repository at this point in the history
…1 (unknown) (#13)
  • Loading branch information
uier authored Oct 30, 2023
1 parent 4c1a713 commit c8fe615
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Database } from "~/types/supabase";
import { z } from "zod";
import { Filter } from "~/types";
import { TRADE_TYPES } from "~/types/constants";
const client = useSupabaseClient<Database>();
const params = useUrlSearchParams("history");
Expand Down Expand Up @@ -41,6 +42,8 @@ const { data: prices } = await useAsyncData(
}
if (filter.value.trade_type !== null) {
query = query.eq("trade_type", filter.value.trade_type);
} else {
query = query.neq("trade_type", TRADE_TYPES.UNKNOWN);
}
if (filter.value.game_id !== undefined) {
query = query.eq("game_id", filter.value.game_id);
Expand All @@ -67,6 +70,7 @@ const { data: trend } = await useAsyncData(
.from("Price")
.select("game_id, price, posted_at, condition, ptt_article_id")
.eq("game_id", filter.value.game_id)
.neq("trade_type", TRADE_TYPES.UNKNOWN)
.order("posted_at", { ascending: true });
return result.data;
},
Expand Down

0 comments on commit c8fe615

Please sign in to comment.