Skip to content

Eliminate overwrite hack being used in convert_input.R #3424

@Sweetdevil144

Description

@Sweetdevil144

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions