Skip to content

Commit

Permalink
Fix the name and project functions
Browse files Browse the repository at this point in the history
  • Loading branch information
katieb1 committed Dec 6, 2023
1 parent b2ecacd commit 7b1fa64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions R/internalHelpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ getScnSet <- function(ssimObject) {
ScenarioID <- NULL
tt <- command(list(list = NULL, scenarios = NULL, csv = NULL, lib = .filepath(ssimObject)), .session(ssimObject))
scnSet <- .dataframeFromSSim(tt, localNames = FALSE, convertToLogical = c("IsReadOnly"))
names(scnSet)[names(scnSet) == "Id"] <- "ScenarioID"
names(scnSet)[names(scnSet) == "ProjectId"] <- "ProjectID"
names(scnSet)[names(scnSet) == "ParentId"] <- "ParentID"
if (nrow(scnSet) == 0) {
scnSet <- merge(scnSet, data.frame(ScenarioID = NA, exists = NA), all = TRUE)
scnSet <- subset(scnSet, !is.na(ScenarioID))
Expand All @@ -164,7 +167,7 @@ getProjectSet <- function(ssimObject) {
if (nrow(projectSet) == 0) {
projectSet[1, "ProjectID"] <- NA
}
# names(projectSet)[names(projectSet) == "iD"] <- "projectId"
names(projectSet)[names(projectSet) == "Id"] <- "ProjectID"
projectSet$exists <- TRUE
projectSet <- subset(projectSet, !is.na(ProjectID))
return(projectSet)
Expand Down Expand Up @@ -723,7 +726,6 @@ datasheets <- function(x, project = NULL, scenario = NULL, scope = NULL, refresh
stop("Can't create new scenarios because there is more than one project in the ssimObject. Please specify the Project ssimObject to which new scenarios should belong.")
}
if (nrow(allProjects) == 0) {
browser()
obj <- project(ssimObject, project = "project1")
project <- .projectId(obj)
} else {
Expand Down
2 changes: 0 additions & 2 deletions R/project.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ NULL

setMethod(f = "initialize", signature = "Project", definition = function(.Object, ssimLibrary, name = NULL, id = NULL, projects = NULL, sourceProject = NULL) {

browser()
ProjectID <- NULL
Name <- NULL

Expand Down Expand Up @@ -310,7 +309,6 @@ project <- function(ssimObject = NULL, project = NULL, sourceProject = NULL, sum
if (projExists) {
projectList[[as.character(projectsToMake$ProjectID[i])]] <- new("Project", ssimObject, id = cRow$ProjectID, projects = subset(allProjects, !is.na(exists)), sourceProject = sourceProject)
} else {
browser()
obj <- new("Project", ssimObject, name = cRow$Name, projects = subset(allProjects, !is.na(exists)), sourceProject = sourceProject)
projectList[[as.character(.projectId(obj))]] <- obj
}
Expand Down

0 comments on commit 7b1fa64

Please sign in to comment.