Skip to content

Commit b349b1c

Browse files
committed
fast fix after the insert_score problem (thanks to @falseFlax and Dasha Gurevich for bringing it up)
1 parent 39df23f commit b349b1c

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: checkdown
22
Type: Package
33
Title: Check-Fields and Check-Boxes for 'rmarkdown'
4-
Version: 0.0.11
4+
Version: 0.0.12
55
Depends: R (>= 3.5.0)
66
Authors@R: c(person("George", "Moroz",
77
role = c("aut", "cre"),

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
checkdown 0.0.12 (27.10.2023)
2+
- fast fix after the `insert_score()` problem (thanks to @falseflax and Dasha Gurevich for bringing it up)
3+
14
checkdown 0.0.11 (18.10.2023)
25
- add the `insert_score()` function (thanks to @Julieblas for bringing it up)
36

R/check_question.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @param type character that defines type of the list. Possible values: \code{text}, \code{select}, \code{radio}, \code{checkbox}, \code{in_order}
88
#' @param button_label character value that will be displayed on the button
99
#' @param placeholder character that defines a short hint that describes the expected value of an input field. This works with the \code{text} input type only.
10-
#' @param alignment logical argument for options' alignment: \code{vertical} or \code{horizontal}
10+
#' @param alignment character argument for options' alignment: \code{vertical} or \code{horizontal}
1111
#' @param random_answer_order logical argument that denotes whether answers should be shuffled, when the \code{type} value is \code{select}, \code{radio} or \code{checkbox}
1212
#' @param title character value that will be displayed as a question title. It is possible to put there the question. You can put markdown markup. Since this argument wraps the form contents with \code{fieldset} tags, you can redefine it appearance with CSS.
1313
#' @param width_of_in_order character with some values for width of the boxes, when the \code{type} value is \code{in_order}. Possible values: "30px", "20\%"

R/zzz.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@
3030
insert_js_code_for_score_calculation <- function() {
3131
df <- utils::read.csv(getOption("checkdown.table"), header = TRUE)
3232
df$rows_id <- seq_along(df$q_id)
33-
paste0("function evaluate_final_score(){",
34-
paste0("var text, ", paste0("res", df$rows_id, collapse = ", "), ";"),
33+
paste0("function evaluate_final_score(){
34+
element = document.getElementById('checkdown_final_score');
35+
if(element === null){return false;} else {",
36+
paste0("var element, text, ", paste0("res", df$rows_id, collapse = ", "), ";"),
3537
paste0(glue::glue_data(df, "res{rows_id} = document.getElementById('result_{q_id}').innerText == '{right}';"), collapse = " "),
3638
paste0("text = ", paste0("res", df$rows_id, collapse = " + "), ";"),
37-
"document.getElementById('checkdown_final_score').innerHTML = text;
38-
return false;}")
39+
"element.innerHTML = text;
40+
return false;
41+
}}")
3942
}

man/check_question.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)