Fix .csv and .json formats

addition of ransack_paginate missed the
setting of the result to @q.result. Readded this.
Do not determine due date #3740

if the value is nil for some responses.

In testing we saw from time to time that a nil response was created for
some integer answers. This caused an error when trying to determine
the due date. This commit adds a check for nil and does not set the due
date for the participant if the integer value is nil.

Closes #3740