Skip to contents

Opens the same Shiny dashboard as run_dashboard(), but reads data from an existing DBI connection instead of a SQLite file path. The caller owns the connection and is responsible for disconnecting it after the dashboard stops.

Usage

run_dashboard_connection(
  con,
  tutorial_id = NULL,
  rule = c("last", "best", "first"),
  include_unregistered = TRUE,
  group_id = NULL,
  host = "127.0.0.1",
  access_token = NULL,
  token_envvar = "LEARNRTRACKR_DASHBOARD_TOKEN",
  allow_remote = FALSE,
  ...
)

Arguments

con

A DBI connection.

tutorial_id

Optional tutorial identifier. If NULL, the first available tutorial found in the database is used.

rule

Scoring rule passed to gradebook().

include_unregistered

If TRUE, include attempted questions that were not registered with register_questions().

group_id

Optional registered student group identifier. If supplied, only students registered in that group are included.

host

Host passed to shiny::runApp(). Defaults to "127.0.0.1" for local-only use.

access_token

Optional dashboard token. If supplied, the dashboard asks for this token before showing data.

token_envvar

Environment variable used to read a dashboard token when access_token is NULL. Set to NULL to disable environment lookup.

allow_remote

If FALSE, refuse to run on a non-local host unless an access token is configured.

...

Additional arguments passed to shiny::runApp().

Value

The return value of shiny::runApp().

Examples

if (FALSE) { # \dontrun{
db_path <- "learnrtrackr.sqlite"
con <- connect_tracking_db(db_path)
run_dashboard_connection(con)
DBI::dbDisconnect(con)
} # }