Skip to content

Commit

Permalink
fixed bugs in link methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyparsons committed Jan 24, 2017
1 parent ff45aa0 commit 03a85ed
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions instat/static/InstatObject/R/instat_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -706,20 +706,26 @@ instat_object$set("public", "delete_dataframe", function(data_name) {
# TODO need a set or append
private$.data_objects[[data_name]] <- NULL
data_objects_changed <- TRUE
ind <- c()
link_name <- ""
for(i in seq_along(private$.links)) {
if(private$.links[[i]]$from_data_frame == data_name || private$.links[[i]]$to_data_frame == data_name) {
ind <- c(ind, i)
link_name <- names(private$.links)[i]
break
}
}
#TODO Should this be delete or disable?
if(length(ind) > 0) {
private$.links[ind] <- NULL
message(length(ind), " links removed")
if(link_name != "") {
#TODO Should this be delete or disable?
self$remove_link(link_name)
}
}
)

instat_object$set("public", "remove_link", function(link_name) {
if(!link_name %in% names(private$.links)) stop(link_name, " not found.")
private$.links[[link_name]] <- NULL
}
)

instat_object$set("public", "get_column_factor_levels", function(data_name,col_name = "") {
self$get_data_objects(data_name)$get_column_factor_levels(col_name)
}
Expand Down

0 comments on commit 03a85ed

Please sign in to comment.