mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-23 06:36:19 +00:00
mover logica de supermercado a db-datos
This commit is contained in:
parent
1d4133e1c8
commit
a8d26f32a5
2 changed files with 17 additions and 17 deletions
16
db-datos/supermercado.ts
Normal file
16
db-datos/supermercado.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
export enum Supermercado {
|
||||
Dia = "Dia",
|
||||
Carrefour = "Carrefour",
|
||||
Coto = "Coto",
|
||||
}
|
||||
|
||||
export const hosts: { [host: string]: Supermercado } = {
|
||||
"diaonline.supermercadosdia.com.ar": Supermercado.Dia,
|
||||
"www.carrefour.com.ar": Supermercado.Carrefour,
|
||||
"www.cotodigital3.com.ar": Supermercado.Coto,
|
||||
};
|
||||
export const colorBySupermercado: { [supermercado in Supermercado]: string } = {
|
||||
[Supermercado.Dia]: "#d52b1e",
|
||||
[Supermercado.Carrefour]: "#19549d",
|
||||
[Supermercado.Coto]: "#e20025",
|
||||
};
|
|
@ -2,26 +2,10 @@
|
|||
import type { Precio } from "db-datos/schema";
|
||||
// import dayjs from "dayjs";
|
||||
import ChartJs from "./ChartJs.svelte";
|
||||
import { hosts, colorBySupermercado } from "db-datos/supermercado";
|
||||
|
||||
export let precios: Precio[];
|
||||
|
||||
enum Supermercado {
|
||||
Dia = "Dia",
|
||||
Carrefour = "Carrefour",
|
||||
Coto = "Coto",
|
||||
}
|
||||
|
||||
const hosts: { [host: string]: Supermercado } = {
|
||||
"diaonline.supermercadosdia.com.ar": Supermercado.Dia,
|
||||
"www.carrefour.com.ar": Supermercado.Carrefour,
|
||||
"www.cotodigital3.com.ar": Supermercado.Coto,
|
||||
};
|
||||
const colorBySupermercado: { [supermercado in Supermercado]: string } = {
|
||||
[Supermercado.Dia]: "#d52b1e",
|
||||
[Supermercado.Carrefour]: "#19549d",
|
||||
[Supermercado.Coto]: "#e20025",
|
||||
};
|
||||
|
||||
$: datasets = precios
|
||||
.map((p) => new URL(p.url!).hostname)
|
||||
.filter(onlyUnique)
|
||||
|
|
Loading…
Reference in a new issue