diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index f6d12a41..1c952be6 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -214,7 +214,7 @@ onMount( async() => {
| + | Time | -+ | Country | Event | Actual | Forecast | @@ -362,7 +408,7 @@ async function handleChangeValue(value) {- {item?.actual !== null ? abbreviateNumber(item?.actual) : '-'} + {item?.actual !== (null || '') ? abbreviateNumber(item?.actual) : '-'} | @@ -380,7 +426,7 @@ async function handleChangeValue(value) { |
{#each Array.from({ length: 3 }) as _, i}
- {#if i <= Math.floor(item?.importance)}
+ {#if i < Math.floor(item?.importance)}
diff --git a/src/routes/economic-calendar/workers/filterWorker.ts b/src/routes/economic-calendar/workers/filterWorker.ts
index 36077a34..29f58eba 100644
--- a/src/routes/economic-calendar/workers/filterWorker.ts
+++ b/src/routes/economic-calendar/workers/filterWorker.ts
@@ -41,26 +41,39 @@ const countryMap = Object.fromEntries(
listOfRelevantCountries.map((entry) => {
const [code, name] = Object.entries(entry)[0];
return [name, code];
- }),
+ })
);
onmessage = async (event: MessageEvent) => {
const rawData = event.data?.rawData;
- const filterList = event.data?.filterList;
+ const filterList: (string | number)[] = event.data?.filterList;
+ console.log(filterList);
+
+ // Separate importance filters and country filters
+ const importanceFilters = filterList.filter(
+ (item) => typeof item === "number" && [1, 2, 3].includes(item as number)
+ ) as number[];
+ const countryFilters = filterList.filter(
+ (item) => typeof item === "string"
+ ) as string[];
// Map filterList country names to abbreviations
- const filterCodes = filterList?.map((name) => countryMap[name]) || [];
+ const filterCodes = countryFilters.map((name) => countryMap[name]) || [];
- // Filter rawData based on the mapped country codes
+ // Filter rawData based on the mapped country codes and importance
const output = rawData?.map((subArray) =>
- subArray?.filter((item) => filterCodes.includes(item?.country)),
+ subArray?.filter((item) => {
+ const countryMatch =
+ filterCodes.length === 0 || filterCodes.includes(item?.country);
+ const importanceMatch =
+ importanceFilters.length === 0 ||
+ importanceFilters.includes(item?.importance);
+ return countryMatch && importanceMatch;
+ })
);
let finalData = { output };
postMessage({ message: "success", finalData });
-
- // Sending data back to the main thread
- //postMessage({ message: 'Data received in the worker', ticker, apiURL });
};
export {};
diff --git a/src/routes/options-flow/+page.svelte b/src/routes/options-flow/+page.svelte
index 620fff10..5214f2a3 100644
--- a/src/routes/options-flow/+page.svelte
+++ b/src/routes/options-flow/+page.svelte
@@ -505,23 +505,6 @@ onDestroy(async() => {
})
-
- async function assetSelector(symbol, assetType)
- {
-
- if(assetType === 'etf')
- {
- etfTicker.update(value => symbol);
- goto(`/etf/${symbol}`)
- }
- else if(assetType === 'stock') {
- stockTicker.update(value => symbol);
- goto(`/stocks/${symbol}`)
- }
-
- }
-
-
function reformatDate(dateString) {
return dateString.substring(5, 7) + '/' + dateString.substring(8) + '/' + dateString.substring(2, 4);
@@ -1232,17 +1215,16 @@ $: {
let:index
let:style
{style}
- class="tr cursor-pointer {index % 2 === 0 ? 'bg-[#27272A]' : 'bg-[#09090B]'}"
+ class="tr {index % 2 === 0 ? 'bg-[#27272A]' : 'bg-[#09090B]'}"
>
{formatTime(displayedData[index]?.time)}
-
- assetSelector(displayedData[index]?.ticker, displayedData[index]?.underlying_type)} style="justify-content: center;" class="td text-sm sm:hover:text-white sm:text-[1rem] text-blue-400 font-normal">
+
{displayedData[index]?.ticker}
-
+
{reformatDate(displayedData[index]?.date_expiration)}
diff --git a/src/routes/price-alert/+page.svelte b/src/routes/price-alert/+page.svelte
index b518b4db..16cb2e41 100644
--- a/src/routes/price-alert/+page.svelte
+++ b/src/routes/price-alert/+page.svelte
@@ -195,7 +195,7 @@ $: charNumber = $screenWidth < 640 ? 15 : 40;
{#if editMode}
- |
|---|