Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix question_is_correct.learnr_text comparison #376

Merged
merged 7 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: '3.6'}
- {os: windows-latest, r: 'devel'}
- {os: macOS-latest, r: '3.6'}
- {os: ubuntu-16.04, r: '3.2', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.3', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.4', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-16.04, r: 'release', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-18.04, r: 'release', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.6', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.5', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.4', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.3', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: ${{ matrix.config.cran }}
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v1
Expand All @@ -57,20 +60,19 @@ jobs:
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-

# remove this step once Rcpp (> 1.0.4) is uploaded
- name: Rcpp band-aid
run: >
Rscript
-e "if (system.file(package = 'Rcpp') == '') install.packages('Rcpp', repos=c('https://RcppCore.github.io/drat', '${{ matrix.config.cran }}'), type = 'source')"
- name: Install libcurl
if: runner.os == 'Linux'
run: |
sudo -s apt-get update
sudo -s apt-get install -y libcurl4-openssl-dev
- name: Install dependencies
run: >
Rscript
-e "library(remotes)"
-e "if (.Platform[['OS.type']] == 'windows' || Sys.info()[['sysname']] == 'Darwin') options(pkgType = 'binary')"
-e "if (.Platform[['OS.type']] == 'windows') remotes::install_cran(c('stringr', 'stringi'))"
-e "update(readRDS('depends.Rds'))"
-e "remotes::install_cran('rcmdcheck')"
Expand All @@ -84,7 +86,7 @@ jobs:
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check

- name: Test coverage
Expand All @@ -108,11 +110,11 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/all/__linux__/bionic/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: ${{ matrix.config.cran }}
RSPM: ${{ matrix.config.rspm }}

steps:
- uses: actions/checkout@v1
Expand All @@ -134,10 +136,10 @@ jobs:
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-deploy-${{ hashFiles('depends.Rds') }}
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-deploy-${{ hashFiles('depends.Rds') }}
restore-keys: |
${{ runner.os }}-r-${{ matrix.config.r }}-deploy-
${{ runner.os }}-r-${{ matrix.config.r }}-
${{ matrix.config.os }}-r-${{ matrix.config.r }}-deploy-
${{ matrix.config.os }}-r-${{ matrix.config.r }}-
- name: Install dependencies
run: >
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ learnr (development version)

## Breaking Changes

* Renamed the `exercise_submission` event to `exercise_result` and added the following fields:
* Renamed the `exercise_submission` event to `exercise_result` and added the following fields:
1. `id` - a randombly generated identifier that can be used to align with the associated `exercise_result` event.
2. `time_elapsed` - the time required to run the exercise (in seconds)
3. `timeout_exceeded` - indicates whether the exercise was interrupted due to an exceeded timeout. May be `NA` for some platforms/evaluators if that information is not known or reported. ([#337](https://github.com/rstudio/learnr/pull/337))


## New features

Expand All @@ -22,6 +22,7 @@ learnr (development version)
## Bug fixes

* Properly enforce time limits and measure exercise execution times that exceed 60 seconds ([#366](https://github.com/rstudio/learnr/pull/366), [#368](https://github.com/rstudio/learnr/pull/368))
* Fixed unexpected behavior for `question_is_correct.learnr_text()` where `trim = FALSE`. Comparisons will now happen with the original input value, not the `HTML()` formatted answer value. ([#376](https://github.com/rstudio/learnr/pull/376))

learnr 0.10.1
===========
Expand Down
2 changes: 1 addition & 1 deletion R/question_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ question_is_correct.learnr_text <- function(question, value, ...) {
}

for (ans in question$answers) {
ans_val <- ans$label
ans_val <- ans$option
if (isTRUE(question$options$trim)) {
ans_val <- str_trim(ans_val)
}
Expand Down