#7108 - exchange-rate #2295
|
@ -10,11 +10,6 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: '/exchangeRateUpdate',
|
path: '/exchangeRateUpdate',
|
||||||
verb: 'post'
|
verb: 'post'
|
||||||
},
|
|
||||||
returns: {
|
|
||||||
arg: 'result',
|
|
||||||
type: 'object',
|
|
||||||
root: true
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jgallego marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
|
@ -29,16 +24,14 @@ module.exports = Self => {
|
||||||
|
|
||||||
const maxDateRecord = await models.ReferenceRate.findOne({order: 'dated DESC'});
|
const maxDateRecord = await models.ReferenceRate.findOne({order: 'dated DESC'});
|
||||||
|
|
||||||
const maxDate = maxDateRecord && maxDateRecord.dated ? new Date(maxDateRecord.dated) : null;
|
const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null;
|
||||||
|
|
||||||
for (let i = 0; i < cubes.length; i++) {
|
for (const cube of Array.from(cubes)) {
|
||||||
const cube = cubes[i];
|
|
||||||
if (cube.nodeType === 1 && cube.attributes.getNamedItem('time')) {
|
if (cube.nodeType === 1 && cube.attributes.getNamedItem('time')) {
|
||||||
const xmlDate = new Date(cube.getAttribute('time'));
|
const xmlDate = new Date(cube.getAttribute('time'));
|
||||||
const xmlDateWithoutTime = new Date(xmlDate.getFullYear(), xmlDate.getMonth(), xmlDate.getDate());
|
const xmlDateWithoutTime = new Date(xmlDate.getFullYear(), xmlDate.getMonth(), xmlDate.getDate());
|
||||||
jgallego marked this conversation as resolved
Outdated
alexm
commented
Se pot simplificar en Se pot simplificar en `const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null;`
jgallego
commented
const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null; Unhandled error for request POST /api/Collections/exchangeRateUpdate?access_token=YQ8SPYxYrHrY4veSEyY5q9YJD3AtcjEqcGXxyA5rweDZO92PLp0FB2WhBxlbTvUO: TypeError: Cannot read properties of null (reading 'dated') Ahir em va fallar..ací t'he posat la conversa amb chatGpt...ara sí va..ho canvie de nou
const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null;
Unhandled error for request POST /api/Collections/exchangeRateUpdate?access_token=YQ8SPYxYrHrY4veSEyY5q9YJD3AtcjEqcGXxyA5rweDZO92PLp0FB2WhBxlbTvUO: TypeError: Cannot read properties of null (reading 'dated')
Ahir em va fallar..ací t'he posat la conversa amb chatGpt...ara sí va..ho canvie de nou
|
|||||||
if (!maxDate || maxDate < xmlDateWithoutTime) {
|
if (!maxDate || maxDate < xmlDateWithoutTime) {
|
||||||
for (let j = 0; j < cube.childNodes.length; j++) {
|
for (const rateCube of Array.from(cube.childNodes)) {
|
||||||
jgallego marked this conversation as resolved
Outdated
alexm
commented
Si no cal la "i" i la "j", vec mes legible fer:
i lo mateix en el altre for Si no cal la "i" i la "j", vec mes legible fer:
```
for (const/let cube of cubes)
```
i lo mateix en el altre for
jgallego
commented
no era iterable li he posat Array.from( no era iterable li he posat Array.from(
|
|||||||
const rateCube = cube.childNodes[j];
|
|
||||||
if (rateCube.nodeType === doc.ELEMENT_NODE) {
|
if (rateCube.nodeType === doc.ELEMENT_NODE) {
|
||||||
const currencyCode = rateCube.getAttribute('currency');
|
const currencyCode = rateCube.getAttribute('currency');
|
||||||
const rate = rateCube.getAttribute('rate');
|
const rate = rateCube.getAttribute('rate');
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ReferenceRate",
|
"name": "ReferenceRate",
|
||||||
"base": "PersistedModel",
|
"base": "PersistedModel",
|
||||||
"idInjection": false,
|
|
||||||
"options": {
|
"options": {
|
||||||
jgallego marked this conversation as resolved
alexm
commented
esta propietat no la havia vist mai esta propietat no la havia vist mai
|
|||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "referenceRate"
|
"table": "referenceRate"
|
||||||
|
|
|
@ -352,14 +352,5 @@
|
||||||
"The line could not be marked": "La linea no puede ser marcada",
|
"The line could not be marked": "La linea no puede ser marcada",
|
||||||
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
|
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
|
||||||
"They're not your subordinate": "No es tu subordinado/a.",
|
"They're not your subordinate": "No es tu subordinado/a.",
|
||||||
"No results found": "No se han encontrado resultados",
|
"No results found": "No se han encontrado resultados"
|
||||||
"ReferenceError: app is not defined": "ReferenceError: app is not defined",
|
}
|
||||||
"TypeError: Cannot read properties of undefined (reading 'ReferenceRate')": "TypeError: Cannot read properties of undefined (reading 'ReferenceRate')",
|
|
||||||
"Error: ER_BAD_FIELD_ERROR: Unknown column 'date' in 'order clause'": "Error: ER_BAD_FIELD_ERROR: Unknown column 'date' in 'order clause'",
|
|
||||||
"ReferenceError: ReferenceRate is not defined": "ReferenceError: ReferenceRate is not defined",
|
|
||||||
"ValidationError: The `ReferenceRate` instance is not valid. Details: `currencyFk` can't be blank (value: NaN).": "ValidationError: The `ReferenceRate` instance is not valid. Details: `currencyFk` can't be blank (value: NaN).",
|
|
||||||
"ReferenceError: Currency is not defined": "ReferenceError: Currency is not defined",
|
|
||||||
"UserError: Currency not found for code: CNY": "UserError: Currency not found for code: CNY",
|
|
||||||
"Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-03' for key 'PRIMARY'": "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-03' for key 'PRIMARY'",
|
|
||||||
"Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-08' for key 'PRIMARY'": "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-08' for key 'PRIMARY'"
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Si no retorna res, no cal ficar return (no estic segur)