-
Notifications
You must be signed in to change notification settings - Fork 2
Home
shinyQuiz is a mix of 'base' R and tidyverse
code. We try to adhere to the tidyverse style guide for code formatting. The easiest way to to format ~90% of your R code is Code -> Reformat Code
within Rstudio.
We use roxygen2
for documenting functions and testthat
for unit testing. Please familiarize yourself with both and feel free to reach out with an issue if you have any questions.
We use renv
to manage dependencies. You can use renv::restore()
to install all the necessary packages. Please limit adding additional packages. Do not add shinyQuiz
as a dependency even if renv
suggests it.
main branch - Production branch
dev branch - Primary developer branch. TBD
gh-pages branch - Automatically created branch from the /_site@master folder that builds to a static website
{other} branch - Unique branches for new features or individual developer work
When adding a new feature, it is recommended to create your own branch and then PR into the dev. Then PR from dev into master. For small fixes, working directly off the dev branch is recommended.
TODO
TODO
A quiz is managed via a state machine framework. The framework requires an object of S4 class quiz
. These are constructed using construct_quiz
and consist of objects of S4 class question
and messages
. These have constructor functions as well.
A quiz
object is created outside of Shiny and passed to a Shiny module. The Shiny module manages the state of the quiz through the central reactive object store
. The store
is created via sm_create_reactive_store
function. The state machine functions (prefixed with sm_*
) get
or set
states. The changing of the store
object facilitates downstream effects via Shiny reactivity.
For example, the quiz UI is determined by an object in the store
object. The current state is observed via a shiny::observeEvent(store$state)
. When the current state changes then a function modifies store$ui_html
. The UI is rendered via shiny::renderUI(store$ui_html)
which watches this ui_html
object.
TODO