Commit 265840fb authored by void's avatar void
Browse files

esconder propuestas de más de 1 mes de inactividad

fixes #2
parent d046440c
Pipeline #35431 passed with stages
in 2 minutes and 36 seconds
......@@ -39,11 +39,23 @@
<h1 v-else>Error: {{ error }}</h1>
</div>
<template v-else-if="consensos.length > 0">
<template v-for="consenso in consensos">
<template v-for="consenso in consensosNuevos">
<consenso :consenso="consenso" :barcaId="barcaId" :key="consenso.id" />
<hr />
</template>
<details class="consensos-viejos">
<summary>Consensos sin actividad por más de un mes</summary>
<template v-for="consenso in consensosViejos">
<consenso
:consenso="consenso"
:barcaId="barcaId"
:key="consenso.id"
/>
<hr />
</template>
</details>
<router-link
class="red btn-abandonar"
tag="button"
......@@ -97,6 +109,18 @@ export default {
.sort((a, b) => new Date(b.created_at) > new Date(a.created_at))
},
}),
consensosNuevos() {
return this.consensos.filter(
consenso =>
new Date(consenso.updated_at) > Date.now() - 1000 * 60 * 60 * 24 * 30,
)
},
consensosViejos() {
return this.consensos.filter(
consenso =>
new Date(consenso.updated_at) < Date.now() - 1000 * 60 * 60 * 24 * 30,
)
},
},
methods: {
refrescar() {
......@@ -155,4 +179,7 @@ hr
.btn-abandonar
display: block
margin: 10px auto
.consensos-viejos
padding: .5em
</style>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment