Skip to content

Count views on answers-only route

Robert Palm requested to merge rapl42/tc-server:view-count-answers into master

This fix is more for sake of completeness since tc-frontend!313 (merged) changed the default behaviour to first refresh the question (which already includes all answers) and then the answers (see here). By the time the answers are requested, the view has already been updated (both on the server and locally) via the first request.

            onRefresh: () async {
              BlocProvider.of<QuestionBloc>(context)
                  .add(UpdateSingleQuestionEvent(question.id));
              BlocProvider.of<AnswerBloc>(context)
                  .add(LoadAnswersEvent(question.id));
            },

I talked to @mlbn33 about it and he said the extra request is fine for now. Maybe we can remove the GET /questions/{questionId}/answers route in the future but until then it properly counts the views.

CC @mczj84

Closes #95 (closed)

Merge request reports