Assign correct correct_option_id.
GitOrigin-RevId: 1c20d8f27a0312805bb696da42d0d39b68f90fc6
This commit is contained in:
parent
eb9a3e7ca3
commit
43704b69e0
@ -1417,8 +1417,7 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
|||||||
is_changed = true;
|
is_changed = true;
|
||||||
}
|
}
|
||||||
int32 correct_option_id = -1;
|
int32 correct_option_id = -1;
|
||||||
for (size_t i = 0; i < poll_results->results_.size(); i++) {
|
for (auto &poll_result : poll_results->results_) {
|
||||||
auto &poll_result = poll_results->results_[i];
|
|
||||||
Slice data = poll_result->option_.as_slice();
|
Slice data = poll_result->option_.as_slice();
|
||||||
for (size_t option_index = 0; option_index < poll->options.size(); option_index++) {
|
for (size_t option_index = 0; option_index < poll->options.size(); option_index++) {
|
||||||
auto &option = poll->options[option_index];
|
auto &option = poll->options[option_index];
|
||||||
@ -1436,9 +1435,9 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
|||||||
bool is_correct = (poll_result->flags_ & telegram_api::pollAnswerVoters::CORRECT_MASK) != 0;
|
bool is_correct = (poll_result->flags_ & telegram_api::pollAnswerVoters::CORRECT_MASK) != 0;
|
||||||
if (is_correct) {
|
if (is_correct) {
|
||||||
if (correct_option_id != -1) {
|
if (correct_option_id != -1) {
|
||||||
LOG(ERROR) << "Receive more than 1 correct answers " << correct_option_id << " and " << i;
|
LOG(ERROR) << "Receive more than 1 correct answers " << correct_option_id << " and " << option_index;
|
||||||
}
|
}
|
||||||
correct_option_id = static_cast<int32>(i);
|
correct_option_id = static_cast<int32>(option_index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
correct_option_id = poll->correct_option_id;
|
correct_option_id = poll->correct_option_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user