98ff62af80
* Update dependency prettier to v3 * upgrade eslint-plugin-prettier and run prettier on all files --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jeldrik Hanschke <admin@jhanschke.de>
30 lines
780 B
JavaScript
30 lines
780 B
JavaScript
import Component from '@glimmer/component';
|
|
import { DateTime } from 'luxon';
|
|
|
|
export default class PollEvaluationParticipantsTable extends Component {
|
|
get optionsPerDay() {
|
|
const { poll } = this.args;
|
|
|
|
const optionsPerDay = new Map();
|
|
for (const option of poll.options.toArray()) {
|
|
optionsPerDay.set(
|
|
option.day,
|
|
optionsPerDay.has(option.day) ? optionsPerDay.get(option.day) + 1 : 0,
|
|
);
|
|
}
|
|
|
|
return new Map(
|
|
Array.from(optionsPerDay.entries()).map(([dayString, count]) => [
|
|
DateTime.fromISO(dayString).toJSDate(),
|
|
count,
|
|
]),
|
|
);
|
|
}
|
|
|
|
get usersSorted() {
|
|
const { poll } = this.args;
|
|
return poll.users
|
|
.toArray()
|
|
.sort((a, b) => (a.creationDate > b.creationDate ? 1 : -1));
|
|
}
|
|
}
|