cygnal/src/store/getters.js
Phyks (Lucas Verney) a7792f5dbb Rework upvotes
Upvotes now reset the `datetime` field of the report, making it appear
as if it was newly reported. They also extend the lifetime for accidents
and GCUM.

This introduces database migrations as well.

Closes https://framagit.org/phyks/cyclassist/issues/41.
2018-09-12 13:51:53 +02:00

19 lines
451 B
JavaScript

import { REPORT_DOWNVOTES_THRESHOLD } from '@/constants';
export function getLastLocation(state) {
const { gpx } = state.location;
if (gpx.length > 0) {
return gpx[gpx.length - 1];
}
return null;
}
export function notDismissedReports(state) {
return state.reports.filter((item) => {
if (item.attributes.downvotes >= REPORT_DOWNVOTES_THRESHOLD) {
return false;
}
return true;
});
}