From 91ee73d71c12b5ec929c38ceedac31f820c44941 Mon Sep 17 00:00:00 2001 From: TEC Date: Sat, 21 May 2022 00:25:33 +0800 Subject: [PATCH] Show links to individual results on completion --- app/resources/surveys/SurveysController.jl | 9 ++++++++- app/resources/surveys/views/thanks.jl.html | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/resources/surveys/SurveysController.jl b/app/resources/surveys/SurveysController.jl index c32e7c0..dd73478 100644 --- a/app/resources/surveys/SurveysController.jl +++ b/app/resources/surveys/SurveysController.jl @@ -41,8 +41,15 @@ function new() end function completed(uid) + uidstr = string(uid, base=UID_ENCBASE) + links = map(["txt", "org", "json"]) do fmt + (fmt, linkto(:result, + survey = string(SURVEY.id, base=10), + responsefile = string(uidstr, '.', fmt), + preserve_query = false)) + end res = html(:surveys, :thanks, layout=:base; - uid=string(uid, base=UID_ENCBASE), survey=SURVEY) + uid=uidstr, survey=SURVEY, resultlinks=links) Genie.Cookies.set!(res, "response-id", "", Dict{String, Any}("maxage" => -1)) Genie.Cookies.set!(res, "response-page", 0, Dict{String, Any}("maxage" => -1)) end diff --git a/app/resources/surveys/views/thanks.jl.html b/app/resources/surveys/views/thanks.jl.html index 2adcaef..7ff9cb0 100644 --- a/app/resources/surveys/views/thanks.jl.html +++ b/app/resources/surveys/views/thanks.jl.html @@ -11,6 +11,11 @@

Thank you for taking part in the survey!

We hope to see you next year 🙂
-

+

You can view your results as + <% map(resultlinks) do (fmt, url) %> + $(fmt) + <% end |> l -> join(l, ", ", ", or ")%> + .

+
Go Home