Is it possible to sort the results in Views of the survey by the total time spent?
e.g. now I see field start date and end, but how I can sort by elapsed time (end date - start date = elapsed)

Comments

andreystrelkov created an issue. See original summary.

djdevin’s picture

Component: Code - Quiz core » Code - Views

Hi,

This sounds like a Views issue - maybe you could use the "Math expression" field (under "Global") to print out the difference of two fields.

You might be able to use https://www.drupal.org/project/views_calc which will let you define a new field that does some sort of calculation.

Check that math expression field and module out and let me know how it goes.

Devin

andreystrelkov’s picture

Thanks for fast answer Devin!
Yes You right, but in Views in sort can not use math expression :(

Now I think if there is a possibility, then add an additional field to the entity of the quiz result, and put the date difference in it with the help of Rules module.
Maybe in future version make this automatic, e.g. add additional property?

djdevin’s picture

True, you can't sort with the math field. But you could export and sort as a workaround.

Adding another field would work - I just want to see if there is a way to do it just with Views Calc, since this is possible with MySQL.

If we add another field, we need to make sure that whenever the start/end dates are updated, that the duration is also updated.