diff --git a/ui/src/CellEdit.svelte b/ui/src/CellEdit.svelte index 5e21e76..7dc30fa 100644 --- a/ui/src/CellEdit.svelte +++ b/ui/src/CellEdit.svelte @@ -88,6 +88,7 @@ slTypes[ColumnType.Email] = "email" slTypes[ColumnType.Date] = "date" slTypes[ColumnType.URL] = "text" + slTypes[ColumnType.Currency] = "currency" let value @@ -115,7 +116,7 @@ }} type={slTypes[type]} style="width:{width}px" - value={value} + value={value} on:sl-input={(e)=>{ value = e.target.value }} diff --git a/ui/src/Queries.svelte b/ui/src/Queries.svelte index 5f93d7c..f370595 100644 --- a/ui/src/Queries.svelte +++ b/ui/src/Queries.svelte @@ -37,23 +37,17 @@ const queryStore = writable(initialQuery); function changeQuery(newQuery) { currentQuery[activeHashB64] = newQuery - console.log("new query", newQuery) queriedData[activeHashB64] = [] $state.rows.forEach((row) => { if (newQuery.length === 0) { queriedData[activeHashB64].push(row.id) } else { - console.log("jjk") // for key and value in row.cells let subbedQuery = newQuery - // console.log("subbedQuery", subbedQuery) Object.keys(row.cells).forEach((cellId) => { - console.log("cellId", cellId) let value: any = '"' + row.cells[cellId]?.value + '"' - console.log($state.columnDefs.find((col) => col.id === cellId)?.type) - if ($state.columnDefs.find((col) => col.id === cellId)?.type === 1) { const tempValue = parseInt(row.cells[cellId]?.value) if (!isNaN(tempValue)) { @@ -62,18 +56,15 @@ function changeQuery(newQuery) { } subbedQuery = subbedQuery.replace(new RegExp(cellId, 'g'), value); - console.log("subbedQuery", subbedQuery, value, cellId) subbedQuery = subbedQuery.replace(new RegExp('contains', 'g'), 'includes'); }) - console.log("subbedQuery", subbedQuery) - if (eval(subbedQuery)) { + // console.log("subbedQuery", subbedQuery) + if (subbedQuery && eval(subbedQuery)) { queriedData[activeHashB64].push(row.id) } } }) - - console.log("queried data", queriedData[activeHashB64]) } // Function to handle query changes diff --git a/ui/src/SummaryRow.svelte b/ui/src/SummaryRow.svelte index a8ac151..a94e1bc 100644 --- a/ui/src/SummaryRow.svelte +++ b/ui/src/SummaryRow.svelte @@ -67,7 +67,7 @@ {@const sum = Object.values(querriedData).reduce((acc, row) => { const cell = row.cells[def.id]; if (cell && cell.value) { - return acc + Number(cell.value); + return acc + Number(cell.value.replace(/[^0-9-.]/g, '')); } return acc; }, 0)} @@ -76,7 +76,7 @@ {@const sum = Object.values(querriedData).reduce((acc, row) => { const cell = row.cells[def.id]; if (cell && cell.value) { - return acc + Number(cell.value); + return acc + Number(cell.value.replace(/[^0-9-.]/g, '')); } return acc; }, 0)} @@ -94,7 +94,7 @@ } } else { console.log(Math.max(acc, Number(cell.value))) - return Math.max(acc, Number(cell.value)); + return Math.max(acc, Number(cell.value.replace(/[^0-9-.]/g, ''))); } } return acc; @@ -114,7 +114,7 @@ return Math.min(acc, dateNumber); } } - return Math.min(acc, Number(cell.value)); + return Math.min(acc, Number(cell.value.replace(/[^0-9-.]/g, ''))); } return acc; }, @@ -126,7 +126,7 @@ {@const values = Object.values(querriedData).map(row => { const cell = row.cells[def.id]; if (cell && cell.value) { - return Number(cell.value); + return Number(cell.value.replace(/[^0-9-.]/g, '')); } }).sort((a, b) => a - b).filter(value => value !== undefined)} @@ -135,7 +135,7 @@ {@const values = Object.values(querriedData).map(row => { const cell = row.cells[def.id]; if (cell && cell.value) { - return Number(cell.value); + return Number(cell.value.replace(/[^0-9-.]/g, '')); } }).filter(value => value !== undefined)} {@const counts = values.reduce((acc, value) => { @@ -152,7 +152,7 @@ {@const values = Object.values(querriedData).map(row => { const cell = row.cells[def.id]; if (cell && cell.value) { - return Number(cell.value); + return Number(cell.value.replace(/[^0-9-.]/g, '')); } }).sort((a, b) => a - b).filter(value => value !== undefined)} {values[values.length - 1] - values[0]} @@ -160,7 +160,7 @@ {@const values = Object.values(querriedData).map(row => { const cell = row.cells[def.id]; if (cell && cell.value) { - return Number(cell.value); + return Number(cell.value.replace(/[^0-9-.]/g, '')); } }).filter(value => value !== undefined)} {@const mean = values.reduce((acc, value) => acc + value, 0) / values.length} @@ -184,7 +184,7 @@ {#if !embedded}