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

Version 4.37 #131

Merged
merged 17 commits into from
Oct 16, 2024
Merged

Version 4.37 #131

merged 17 commits into from
Oct 16, 2024

Conversation

nickdickinson
Copy link
Collaborator

@nickdickinson nickdickinson commented Sep 23, 2024

R/forms.R Outdated Show resolved Hide resolved
DESCRIPTION Outdated Show resolved Hide resolved
R/forms.R Outdated Show resolved Hide resolved
R/forms.R Show resolved Hide resolved
R/forms.R Outdated Show resolved Hide resolved
R/forms.R Outdated Show resolved Hide resolved
R/forms.R Outdated Show resolved Hide resolved
… and adding maxDepth to styles; Some additional tests
NEWS.md Show resolved Hide resolved
R/forms.R Outdated
#' @export
createFormSchemaFromData <- function(x, databaseId, label, folderId = databaseId, keyColumns = character(), requiredColumns = keyColumns, logicalAsSingleSelect = TRUE, logicalText = c("True","False"), codes = rep(NA_character_, ncol(x)), upload = FALSE) {
createFormSchemaFromData <- function(x, databaseId, label, folderId, keyColumns = character(), requiredColumns = keyColumns, logicalAsSingleSelect = TRUE, logicalText = c("True","False"), codes = rep(NA_character_, ncol(x)), upload = FALSE, parentId = folderId, parentFormId = NULL, parentIdColumn = NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename parentIdColumn to parentRecordIdColumn

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted an inconsistency. In importRecords we use parentIdColumn but I think we should rename this to be parentRecordIdColumn to match and to be consistent also with submitPending() and addRecord(). Since it would be a breaking change, I'll just deprecate the old parameter.

R/forms.R Outdated
stopifnot("Some key columns do not exist in the data.frame provided" = keyColumns %in% providedCols)
stopifnot("Some required columns do not exist in the data.frame provided" = keyColumns %in% providedCols)

fmSchema <- formSchema(databaseId = databaseId, label = label, folderId = folderId)
stopifnot("The parentIdColumn does not exist in the data.frame provided" = parentIdColumn %in% providedCols)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check this logic

R/forms.R Outdated
if(!missing(folderId)) {
if (!missing(parentId) && !is.null(parentId) && folderId != parentId) {
warning("folderId does not match parentId. folderId is deprecated in createFormSchemaFromData(). Ignoring folderId and using parentId.")
folderId = parentId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is odd, we should only be doing this when parentId is NULL and folderId is provided

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be the same logic as formSchema

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a bug as folderId is now never provided when uploading schema

R/records.R Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a test to cover long reference branches and cyclical references, to ensure both are handled safely by these methods

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, make sure the expression built by these column styles use form/field ids in all cases even when field codes have been defined, as these are guaranteed to be generate correct expressions.

@@ -4,10 +4,12 @@
\alias{allColumnStyle}
\title{A form table style including all columns with configurable label names}
\usage{
allColumnStyle(columnNames = c("code", "label"))
allColumnStyle(columnNames = c("code", "label"), maxDepth = 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxDepth should default to 2 in all cases. This will allow users to pull in fields from directly reference forms which probably covers the vast majority of cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to add to .gitignore?

nickdickinson and others added 4 commits October 14, 2024 16:17
…n importRecords() and createFormSchemaFromData(); Other fixes to createFormSchemaFromData() logic and checks; added regex sanitation check for ids in formFieldSchema(); deprecation warning in roleFilter(); update to News; delete testhat-problems.rds
… parentIdColumn in importRecords(); Tests for the number of columns of deeply nested subforms and references and cycles with reference fields; documentation update
@jamiewhths jamiewhths merged commit 3b85289 into master Oct 16, 2024
4 checks passed
@jamiewhths jamiewhths deleted the version-4.37 branch November 12, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants