mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 13:55:23 +02:00
Fix TypeScript errors in experiments feature
- Add experimentMap/onOpenExperiment props to WeeklyRow component - Export VendorDailyRow type from supabase.ts - Fix type errors in experiments.ts (unknown[] to string[]) - Add type annotation for allAsins in App.tsx Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
co-authored by
Qwen-Coder
parent
f93d92da0b
commit
a21c0d532c
@@ -163,16 +163,16 @@ export const getActiveExperimentsForASINs = async (
|
||||
if (error) throw error;
|
||||
|
||||
const map = new Map<string, ActiveExperiment[]>();
|
||||
|
||||
|
||||
for (const asin of asins) {
|
||||
const experiments = (data || [])
|
||||
.filter((exp: any) => exp.asins?.includes(asin))
|
||||
.filter((exp: any) => Array.isArray(exp.asins) && exp.asins.includes(asin))
|
||||
.map((exp: any) => {
|
||||
const endDate = exp.end_date ? new Date(exp.end_date) : null;
|
||||
const daysRemaining = endDate
|
||||
? Math.ceil((endDate.getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24))
|
||||
: undefined;
|
||||
|
||||
|
||||
return {
|
||||
asin,
|
||||
experiment_id: exp.id,
|
||||
@@ -184,7 +184,7 @@ export const getActiveExperimentsForASINs = async (
|
||||
days_remaining: daysRemaining,
|
||||
} as ActiveExperiment;
|
||||
});
|
||||
|
||||
|
||||
if (experiments.length > 0) {
|
||||
map.set(asin, experiments);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user