Fix: RawData Number Format
This commit is contained in:
		| @@ -14,12 +14,12 @@ const toTSV = (data: CotizacionBolsa[]) => { | ||||
|         // Formateamos el nombre para que quede como "GGAL.BA (GRUPO FINANCIERO GALICIA)" | ||||
|         const nombreCompleto = `${row.ticker} (${row.nombreEmpresa || ''})`; | ||||
|         const precio = `$${formatCurrency(row.precioActual)}` | ||||
|         const cambio = `${row.porcentajeCambio.toFixed(2)}%` | ||||
|         const cambio = `${formatCurrency(row.porcentajeCambio)}%` //`${row.porcentajeCambio.toFixed(2)}%` | ||||
|  | ||||
|         // Unimos los campos con un carácter de tabulación '\t' | ||||
|         return [nombreCompleto, precio, cambio].join('\t'); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Unimos todas las filas con un salto de línea | ||||
|     return dataRows.join('\n'); | ||||
| }; | ||||
| @@ -32,14 +32,14 @@ export const RawBolsaLocalTable = () => { | ||||
|  | ||||
|     // Separamos los datos en prioritarios y el resto | ||||
|     const priorityData = data?.filter(d => TICKERS_PRIORITARIOS_LOCAL.includes(d.ticker)) | ||||
|                              .sort((a, b) => TICKERS_PRIORITARIOS_LOCAL.indexOf(a.ticker) - TICKERS_PRIORITARIOS_LOCAL.indexOf(b.ticker)); // Mantenemos el orden | ||||
|      | ||||
|         .sort((a, b) => TICKERS_PRIORITARIOS_LOCAL.indexOf(a.ticker) - TICKERS_PRIORITARIOS_LOCAL.indexOf(b.ticker)); // Mantenemos el orden | ||||
|  | ||||
|     const otherData = data?.filter(d => !TICKERS_PRIORITARIOS_LOCAL.includes(d.ticker)); | ||||
|  | ||||
|     const handleCopy = () => { | ||||
|         if (!priorityData) return; | ||||
|         const tsvData = toTSV(priorityData); | ||||
|          | ||||
|  | ||||
|         copyToClipboard(tsvData) | ||||
|             .then(() => alert('Datos prioritarios copiados al portapapeles.')) | ||||
|             .catch(err => { | ||||
| @@ -81,7 +81,7 @@ export const RawBolsaLocalTable = () => { | ||||
|                                     <Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography> | ||||
|                                 </TableCell> | ||||
|                                 <TableCell align="right">${formatCurrency(row.precioActual)}</TableCell> | ||||
|                                 <TableCell align="right">{row.porcentajeCambio.toFixed(2)}%</TableCell> | ||||
|                                 <TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell> | ||||
|                             </TableRow> | ||||
|                         ))} | ||||
|                     </TableBody> | ||||
| @@ -98,17 +98,20 @@ export const RawBolsaLocalTable = () => { | ||||
|                         <Table size="small"> | ||||
|                             <TableHead> | ||||
|                                 <TableRow> | ||||
|                                     <TableCell>Ticker</TableCell> | ||||
|                                     <TableCell>Nombre</TableCell> | ||||
|                                     <TableCell align="right">Precio</TableCell> | ||||
|                                     <TableCell>Símbolo (Nombre)</TableCell> | ||||
|                                     <TableCell align="right">Precio Actual</TableCell> | ||||
|                                     <TableCell align="right">% Cambio</TableCell> | ||||
|                                 </TableRow> | ||||
|                             </TableHead> | ||||
|                             <TableBody> | ||||
|                                 {otherData.map(row => ( | ||||
|                                     <TableRow key={row.id}> | ||||
|                                         <TableCell>{row.ticker}</TableCell> | ||||
|                                         <TableCell>{row.nombreEmpresa}</TableCell> | ||||
|                                         <TableCell> | ||||
|                                             <Typography component="span" sx={{ fontWeight: 'bold' }}>{row.ticker}</Typography> | ||||
|                                             <Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography> | ||||
|                                         </TableCell> | ||||
|                                         <TableCell align="right">${formatCurrency(row.precioActual)}</TableCell> | ||||
|                                         <TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell> | ||||
|                                     </TableRow> | ||||
|                                 ))} | ||||
|                             </TableBody> | ||||
|   | ||||
| @@ -18,7 +18,7 @@ const toTSV = (data: CotizacionBolsa[]) => { | ||||
|         // Formateamos los datos según los requisitos de redacción | ||||
|         const nombreCompleto = `${row.ticker} (${row.nombreEmpresa || ''})`; | ||||
|         const precio = `$${formatCurrency(row.precioActual)}`; | ||||
|         const cambio = `${row.porcentajeCambio.toFixed(2)}%`; | ||||
|         const cambio = `${formatCurrency(row.porcentajeCambio)}%`; | ||||
|  | ||||
|         return [nombreCompleto, precio, cambio].join('\t'); | ||||
|     }); | ||||
| @@ -35,14 +35,14 @@ export const RawBolsaUsaTable = () => { | ||||
|  | ||||
|     // Separamos los datos en prioritarios y el resto, manteniendo el orden de la lista | ||||
|     const priorityData = data?.filter(d => TICKERS_PRIORITARIOS_USA.includes(d.ticker)) | ||||
|                              .sort((a, b) => TICKERS_PRIORITARIOS_USA.indexOf(a.ticker) - TICKERS_PRIORITARIOS_USA.indexOf(b.ticker)); | ||||
|      | ||||
|         .sort((a, b) => TICKERS_PRIORITARIOS_USA.indexOf(a.ticker) - TICKERS_PRIORITARIOS_USA.indexOf(b.ticker)); | ||||
|  | ||||
|     const otherData = data?.filter(d => !TICKERS_PRIORITARIOS_USA.includes(d.ticker)); | ||||
|  | ||||
|     const handleCopy = () => { | ||||
|         if (!priorityData) return; | ||||
|         const tsvData = toTSV(priorityData); | ||||
|          | ||||
|  | ||||
|         copyToClipboard(tsvData) | ||||
|             .then(() => alert('Datos prioritarios copiados al portapapeles!')) | ||||
|             .catch(err => { | ||||
| @@ -91,8 +91,8 @@ export const RawBolsaUsaTable = () => { | ||||
|                                     <Typography component="span" sx={{ fontWeight: 'bold' }}>{row.ticker}</Typography> | ||||
|                                     <Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography> | ||||
|                                 </TableCell> | ||||
|                                 <TableCell align="right">{formatCurrency(row.precioActual, 'USD')}</TableCell> | ||||
|                                 <TableCell align="right">{row.porcentajeCambio.toFixed(2)}%</TableCell> | ||||
|                                 <TableCell align="right">${formatCurrency(row.precioActual)}</TableCell> | ||||
|                                 <TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell> | ||||
|                             </TableRow> | ||||
|                         ))} | ||||
|                     </TableBody> | ||||
| @@ -109,17 +109,20 @@ export const RawBolsaUsaTable = () => { | ||||
|                         <Table size="small"> | ||||
|                             <TableHead> | ||||
|                                 <TableRow> | ||||
|                                     <TableCell>Ticker</TableCell> | ||||
|                                     <TableCell>Nombre</TableCell> | ||||
|                                     <TableCell align="right">Precio</TableCell> | ||||
|                                     <TableCell>Símbolo (Nombre)</TableCell> | ||||
|                                     <TableCell align="right">Precio Actual</TableCell> | ||||
|                                     <TableCell align="right">% Cambio</TableCell> | ||||
|                                 </TableRow> | ||||
|                             </TableHead> | ||||
|                             <TableBody> | ||||
|                                 {otherData.map(row => ( | ||||
|                                     <TableRow key={row.id}> | ||||
|                                         <TableCell>{row.ticker}</TableCell> | ||||
|                                         <TableCell>{row.nombreEmpresa}</TableCell> | ||||
|                                         <TableCell align="right">{formatCurrency(row.precioActual, 'USD')}</TableCell> | ||||
|                                         <TableCell> | ||||
|                                             <Typography component="span" sx={{ fontWeight: 'bold' }}>{row.ticker}</Typography> | ||||
|                                             <Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography> | ||||
|                                         </TableCell> | ||||
|                                         <TableCell align="right">${formatCurrency(row.precioActual)}</TableCell> | ||||
|                                         <TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell> | ||||
|                                     </TableRow> | ||||
|                                 ))} | ||||
|                             </TableBody> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user