mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
WIP(ApQuestionService.ts
): non-null assertionを消す
エラーメッセージを考える必要がある。
This commit is contained in:
parent
5e715b2105
commit
d0e00c8d17
@ -91,12 +91,14 @@ export class ApQuestionService {
|
||||
if (question.type !== 'Question') throw new Error('object is not a Question');
|
||||
|
||||
const apChoices = question.oneOf ?? question.anyOf;
|
||||
if (apChoices == null) throw new Error(''); // TODO
|
||||
|
||||
let changed = false;
|
||||
|
||||
for (const choice of poll.choices) {
|
||||
const oldCount = poll.votes[poll.choices.indexOf(choice)];
|
||||
const newCount = apChoices!.filter(ap => ap.name === choice)[0].replies!.totalItems;
|
||||
const newCount = apChoices.filter(ap => ap.name === choice).at(0)?.replies?.totalItems;
|
||||
if (newCount == null) throw new Error(''); // TODO
|
||||
|
||||
if (oldCount !== newCount) {
|
||||
changed = true;
|
||||
|
Loading…
Reference in New Issue
Block a user