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

Eliminate overwrite hack being used in convert_input.R #3424

Open
Sweetdevil144 opened this issue Jan 27, 2025 · 0 comments
Open

Eliminate overwrite hack being used in convert_input.R #3424

Sweetdevil144 opened this issue Jan 27, 2025 · 0 comments

Comments

@Sweetdevil144
Copy link
Contributor

Concerned code line :

if (overwrite) {

if (overwrite) {
        # A bit hacky, but need to make sure that all fields are updated to expected
        # values (i.e., what they'd be if convert_input was creating a new record)
        if (exists("existing.input") && nrow(existing.input[[i]]) > 0) {
            db.query(paste0("UPDATE inputs SET name='", basename(dirname(result[[i]]$file[1])),
                                      "' WHERE id=", existing.input[[i]]$id), con)
          
        }
        
        if (exists("existing.dbfile") && nrow(existing.dbfile[[i]]) > 0) {
            db.query(paste0("UPDATE dbfiles SET file_path='", dirname(result[[i]]$file[1]),
                                      "', ", "file_name='", result[[i]]$dbfile.name[1], 
                                      "' WHERE id=", existing.dbfile[[i]]$id), con)
          
        }
      }

Any more info about usage of this piece of code, maybe how do we eliminate these hacks within convert_input ?

Will reference those changes in #3338 once all concepts are clear.

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

No branches or pull requests

1 participant