cygnal/src/store/getters.js
Phyks (Lucas Verney) 9d4842b44c Clicking on a report now shows more infos and let users dismiss it
You should update your database by running
```
ALTER TABLE report ADD COLUMN (upvotes INTEGER NOT NULL, downvotes INTEGER NOT NULL)
```

Fix issue #8.
2018-07-06 15:39:35 +02:00

11 lines
331 B
JavaScript

import { REPORT_VOTES_THRESHOLD } from '@/constants';
export function notDismissedReports(state) {
return state.reports.filter((item) => {
if (item.attributes.downvotes === 0) {
return true;
}
return (item.attributes.upvotes / item.attributes.downvotes) > REPORT_VOTES_THRESHOLD;
});
}