Skip to content
Snippets Groups Projects

Create a preview mode for publishing survey data

Merged Remco Tukker requested to merge feature/COMP-258_publishing into develop
1 unresolved thread
  • The compendium frontend now has a preview flag that can be activated by visiting any data page with a ?preview query parameter. This works with the usePreview hook that uses the previewContext
  • This preview flag is passed along to the backend (again as ?preview ) in all api calls in the new useData hook
  • We have a new preview_year table that contains the years that should only be visible in preview mode
  • This table is used in the new get_data helper function that is called from all the routes
  • The preview_year table is managed from the survey management page, that now has a 'preview' and a 'publish' button (there's a corresponding new endpoint for the preview button)
  • To keep track of whether the survey is in preview there's a new 'preview' survey status. The 'checked' response status is removed because it isnt used
Edited by Remco Tukker

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
56 59 data,
57 60 str(response.status_code)))
58 61 return response
62
63
64 def get_data(table_class):
65 select_statement = select(table_class).join(NREN).order_by(NREN.name.asc(), table_class.year.desc())
66 preview = request.args.get('preview') is not None
  • as it's done here, preview mode is available to anyone that knows to add ?preview to the URL - is this OK?

    I would assume so, but maybe not..

  • Yes, I guess we should confirm this in the next meeting. Honestly I didn't even consider the possibility that it really has to be hidden behind a login..

  • if we have to limit it, current_user can be checked anywhere.. so not a big deal either way

  • Please register or sign in to reply
  • Remco Tukker mentioned in commit 1e47b8ce

    mentioned in commit 1e47b8ce

  • merged

  • Please register or sign in to reply
    Loading