new formula
This commit is contained in:
@@ -9,6 +9,7 @@ COPY . .
|
||||
# build stage
|
||||
FROM develop-stage as build-stage
|
||||
RUN npm i
|
||||
RUN npx --yes update-browserslist-db@latest
|
||||
RUN quasar build
|
||||
|
||||
# production stage
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1060,9 +1060,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001473",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001473.tgz",
|
||||
"integrity": "sha512-ewDad7+D2vlyy+E4UJuVfiBsU69IL+8oVmTuZnH5Q6CIUbxNfI50uVpRHbUPDD6SUaN2o0Lh4DhTrvLG/Tn1yg==",
|
||||
"version": "1.0.30001539",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001539.tgz",
|
||||
"integrity": "sha512-hfS5tE8bnNiNvEOEkm8HElUHroYwlqMMENEzELymy77+tJ6m+gA2krtHl5hxJaj71OlpC2cHZbdSMX1/YEqEkA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
|
||||
14
package.json
14
package.json
@@ -11,24 +11,24 @@
|
||||
"test": "echo \"No test specified\" && exit 0"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.2.1",
|
||||
"@quasar/extras": "^1.0.0",
|
||||
"axios": "^1.2.1",
|
||||
"quasar": "^2.6.0",
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.10.0",
|
||||
"eslint-plugin-vue": "^9.0.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"prettier": "^2.5.1",
|
||||
"@quasar/app-vite": "^1.0.0",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"postcss": "^8.4.14"
|
||||
"eslint": "^8.10.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-vue": "^9.0.0",
|
||||
"postcss": "^8.4.14",
|
||||
"prettier": "^2.5.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18 || ^16 || ^14.19",
|
||||
"npm": ">= 6.13.4",
|
||||
"yarn": ">= 1.21.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,37 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import axios from "axios";
|
||||
import { ref } from "vue";
|
||||
import { date } from "quasar";
|
||||
|
||||
const humedad_relativa = ref(0);
|
||||
const temp_max = ref(0);
|
||||
const data = ref([]);
|
||||
const fecha = ref("");
|
||||
const days = ref(0);
|
||||
|
||||
const calcular =async () => {
|
||||
const result = fetch(
|
||||
"http://api.openweathermap.org/data/2.5/forecast?lat=39.55&lon=-0.5667&units=metric&appid=1ce95ef35a6852cecee421a923fe4400"
|
||||
)
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
return response.json();
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
data.value = await result;
|
||||
console.log(data.value.list);
|
||||
let temp = 0;
|
||||
|
||||
data.value.list.forEach((element) => {
|
||||
temp += element.main.temp;
|
||||
});
|
||||
temp = temp / data.value.list.length;
|
||||
// subimos el 0.25% la temperatura, openweathermap es muy fresquito!!
|
||||
temp = temp * 0.75;
|
||||
console.log(Math.floor(100 / temp), temp);
|
||||
days.value = Math.floor(100 / temp);
|
||||
|
||||
const calcular = () => {
|
||||
let valor = 0;
|
||||
valor = temp_max.value - humedad_relativa.value * 0.2;
|
||||
// ajustar
|
||||
valor = valor * 0.27;
|
||||
let hoy = new Date();
|
||||
let newDate = date.addToDate(hoy, { days: Math.round(valor) });
|
||||
let newDate = date.addToDate(hoy, { days: days.value });
|
||||
fecha.value = newDate.toLocaleDateString("es-es", {
|
||||
weekday: "long",
|
||||
year: "numeric",
|
||||
@@ -28,26 +44,4 @@ const calcular = () => {
|
||||
day: "numeric",
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
axios
|
||||
.get(
|
||||
`https://api.open-meteo.com/v1/forecast?latitude=39.55&longitude=-0.57&hourly=relativehumidity_2m&models=gfs_global&daily=temperature_2m_max,temperature_2m_min&timezone=Europe%2FLondon`
|
||||
)
|
||||
.then((res) => {
|
||||
//console.log("humedad relativa", res.data.hourly.relativehumidity_2m);
|
||||
let suma_humedad = 0;
|
||||
res.data.hourly.relativehumidity_2m.forEach((element) => {
|
||||
suma_humedad += element;
|
||||
});
|
||||
humedad_relativa.value =
|
||||
suma_humedad / res.data.hourly.relativehumidity_2m.length;
|
||||
//console.log("temp máxima", res.data.daily.temperature_2m_max);
|
||||
let suma_temp_max = 0;
|
||||
res.data.daily.temperature_2m_max.forEach((element) => {
|
||||
suma_temp_max += element;
|
||||
});
|
||||
temp_max.value = suma_temp_max / res.data.daily.temperature_2m_max.length;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user