Skip to content

Commit

Permalink
Merge branch 'release-3.7.0' into release-3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
krgauraw committed Feb 24, 2021
2 parents 31b402f + 7dc0834 commit f6e7fbf
Show file tree
Hide file tree
Showing 33 changed files with 345 additions and 341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -83,7 +83,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -111,7 +111,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -144,7 +144,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -174,7 +174,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -204,7 +204,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -237,7 +237,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down Expand Up @@ -296,7 +296,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"status" -> "Review",
Expand Down Expand Up @@ -381,7 +381,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
}

def getCassandraHierarchy(): Response = {
val hierarchyString: String = """{"children":[{"parent":"do_113165166851596288123","totalQuestions":0,"code":"QS_V_Parent_Old","allowSkip":"No","description":"QS-2_parent","language":["English"],"mimeType":"application/vnd.sunbird.questionset","showHints":"No","createdOn":"2020-12-04T15:31:45.948+0530","objectType":"QuestionSet","primaryCategory":"Practice Question Set","lastUpdatedOn":"2020-12-04T15:31:45.947+0530","showSolutions":"No","identifier":"do_11316516745992601613","lastStatusChangedOn":"2020-12-04T15:31:45.948+0530","requiresSubmit":"No","visibility":"Parent","maxQuestions":0,"index":1,"setType":"materialised","languageCode":["en"],"version":1,"versionKey":"1607076105948","showFeedback":"No","depth":1,"name":"QS_V_Parent_2","navigationMode":"non-linear","shuffle":"Yes","status":"Draft"},{"parent":"do_113165166851596288123","totalQuestions":0,"code":"QS_V_Parent_New","allowSkip":"No","description":"QS-1_parent","language":["English"],"mimeType":"application/vnd.sunbird.questionset","showHints":"No","createdOn":"2020-12-04T15:31:45.872+0530","objectType":"QuestionSet","primaryCategory":"Practice Question Set","children":[{"parent":"do_11316516745922969611","identifier":"do_11316399038283776016","lastStatusChangedOn":"2020-12-02T23:36:59.783+0530","code":"question.code","visibility":"Default","index":1,"language":["English"],"mimeType":"application/vnd.sunbird.question","languageCode":["en"],"createdOn":"2020-12-02T23:36:59.783+0530","version":1,"objectType":"Question","versionKey":"1606932419783","depth":2,"primaryCategory":"Practice Question Set","name":"question_1","lastUpdatedOn":"2020-12-02T23:36:59.783+0530","status":"Draft"}],"lastUpdatedOn":"2020-12-04T15:31:45.861+0530","showSolutions":"No","identifier":"do_11316516745922969611","lastStatusChangedOn":"2020-12-04T15:31:45.876+0530","requiresSubmit":"No","visibility":"Parent","maxQuestions":0,"index":2,"setType":"materialised","languageCode":["en"],"version":1,"versionKey":"1607076105872","showFeedback":"No","depth":1,"name":"QS_V_Parent_1","navigationMode":"non-linear","shuffle":"Yes","status":"Draft"},{"identifier":"do_11315445058114355211","parent":"do_113165166851596288123","lastStatusChangedOn":"2020-11-19T12:08:13.854+0530","code":"finemanfine","visibility":"Default","index":4,"language":["English"],"mimeType":"application/vnd.sunbird.question","languageCode":["en"],"createdOn":"2020-11-19T12:08:13.854+0530","version":1,"objectType":"Question","versionKey":"1605767893854","depth":1,"name":"question_1","lastUpdatedOn":"2020-11-19T12:08:13.854+0530","contentType":"Resource","status":"Draft"},{"identifier":"do_11315319237189632011","parent":"do_113165166851596288123","lastStatusChangedOn":"2020-11-17T17:28:23.277+0530","code":"finemanfine","visibility":"Default","index":3,"language":["English"],"mimeType":"application/vnd.sunbird.question","languageCode":["en"],"createdOn":"2020-11-17T17:28:23.277+0530","version":1,"objectType":"Question","versionKey":"1605614303277","depth":1,"name":"question_1","lastUpdatedOn":"2020-11-17T17:28:23.277+0530","contentType":"Resource","status":"Draft"}],"identifier":"do_113165166851596288123"}"""
val hierarchyString: String = """{"children":[{"parent":"do_113165166851596288123","totalQuestions":0,"code":"QS_V_Parent_Old","allowSkip":"No","description":"QS-2_parent","language":["English"],"mimeType":"application/vnd.sunbird.questionset","showHints":"No","createdOn":"2020-12-04T15:31:45.948+0530","objectType":"QuestionSet","primaryCategory":"Practice Question Set","lastUpdatedOn":"2020-12-04T15:31:45.947+0530","showSolutions":"No","identifier":"do_11316516745992601613","lastStatusChangedOn":"2020-12-04T15:31:45.948+0530","requiresSubmit":"No","visibility":"Parent","maxQuestions":0,"index":1,"setType":"materialised","languageCode":["en"],"version":1,"versionKey":"1607076105948","showFeedback":"No","depth":1,"name":"QS_V_Parent_2","navigationMode":"non-linear","shuffle":true,"status":"Draft"},{"parent":"do_113165166851596288123","totalQuestions":0,"code":"QS_V_Parent_New","allowSkip":"No","description":"QS-1_parent","language":["English"],"mimeType":"application/vnd.sunbird.questionset","showHints":"No","createdOn":"2020-12-04T15:31:45.872+0530","objectType":"QuestionSet","primaryCategory":"Practice Question Set","children":[{"parent":"do_11316516745922969611","identifier":"do_11316399038283776016","lastStatusChangedOn":"2020-12-02T23:36:59.783+0530","code":"question.code","visibility":"Default","index":1,"language":["English"],"mimeType":"application/vnd.sunbird.question","languageCode":["en"],"createdOn":"2020-12-02T23:36:59.783+0530","version":1,"objectType":"Question","versionKey":"1606932419783","depth":2,"primaryCategory":"Practice Question Set","name":"question_1","lastUpdatedOn":"2020-12-02T23:36:59.783+0530","status":"Draft"}],"lastUpdatedOn":"2020-12-04T15:31:45.861+0530","showSolutions":"No","identifier":"do_11316516745922969611","lastStatusChangedOn":"2020-12-04T15:31:45.876+0530","requiresSubmit":"No","visibility":"Parent","maxQuestions":0,"index":2,"setType":"materialised","languageCode":["en"],"version":1,"versionKey":"1607076105872","showFeedback":"No","depth":1,"name":"QS_V_Parent_1","navigationMode":"non-linear","shuffle":true,"status":"Draft"},{"identifier":"do_11315445058114355211","parent":"do_113165166851596288123","lastStatusChangedOn":"2020-11-19T12:08:13.854+0530","code":"finemanfine","visibility":"Default","index":4,"language":["English"],"mimeType":"application/vnd.sunbird.question","languageCode":["en"],"createdOn":"2020-11-19T12:08:13.854+0530","version":1,"objectType":"Question","versionKey":"1605767893854","depth":1,"name":"question_1","lastUpdatedOn":"2020-11-19T12:08:13.854+0530","contentType":"Resource","status":"Draft"},{"identifier":"do_11315319237189632011","parent":"do_113165166851596288123","lastStatusChangedOn":"2020-11-17T17:28:23.277+0530","code":"finemanfine","visibility":"Default","index":3,"language":["English"],"mimeType":"application/vnd.sunbird.question","languageCode":["en"],"createdOn":"2020-11-17T17:28:23.277+0530","version":1,"objectType":"Question","versionKey":"1605614303277","depth":1,"name":"question_1","lastUpdatedOn":"2020-11-17T17:28:23.277+0530","contentType":"Resource","status":"Draft"}],"identifier":"do_113165166851596288123"}"""
val response = new Response
response.put("hierarchy", hierarchyString)
}
Expand Down Expand Up @@ -443,7 +443,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory {
"navigationMode" -> "linear",
"allowSkip" -> "Yes",
"requiresSubmit" -> "No",
"shuffle" -> "Yes",
"shuffle" -> true.asInstanceOf[AnyRef],
"showFeedback" -> "Yes",
"showSolutions" -> "Yes",
"showHints" -> "Yes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object HierarchyManager {
else
java.util.Arrays.asList("collections","children","usedByContent","item_sets","methods","libraries","editorState")
}

@throws[Exception]
def addLeafNodesToHierarchy(request:Request)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = {
validateRequest(request)
Expand Down Expand Up @@ -216,7 +216,8 @@ object HierarchyManager {

@throws[Exception]
def getPublishedHierarchy(request: Request)(implicit ec: ExecutionContext, oec: OntologyEngineContext): Future[Response] = {
val redisHierarchy = RedisCache.get(hierarchyPrefix + request.get("rootId"))
val redisHierarchy = if(Platform.getBoolean("questionset.cache.enable", false)) RedisCache.get(hierarchyPrefix + request.get("rootId")) else ""

val hierarchyFuture = if (StringUtils.isNotEmpty(redisHierarchy)) {
Future(mapAsJavaMap(Map("questionSet" -> JsonUtils.deserialize(redisHierarchy, classOf[java.util.Map[String, AnyRef]]))))
} else getCassandraHierarchy(request)
Expand Down Expand Up @@ -428,8 +429,9 @@ object HierarchyManager {
hierarchy.map(hierarchy => {
if (!hierarchy.isEmpty) {
if (StringUtils.isNotEmpty(hierarchy.getOrDefault("status", "").asInstanceOf[String]) && statusList.contains(hierarchy.getOrDefault("status", "").asInstanceOf[String])) {
rootHierarchy.put("questionSet", hierarchy)
RedisCache.set(hierarchyPrefix + request.get("rootId"), JsonUtils.serialize(hierarchy))
val hierarchyMap = mapAsJavaMap(hierarchy)
rootHierarchy.put("questionSet", hierarchyMap)
RedisCache.set(hierarchyPrefix + request.get("rootId"), JsonUtils.serialize(hierarchyMap))
Future(rootHierarchy)
} else {
Future(new util.HashMap[String, AnyRef]())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ object UpdateHierarchyManager {

private def createNewNode(nodeId: String, idMap: mutable.Map[String, String], metadata: java.util.HashMap[String, AnyRef], nodeList: List[Node], request: Request, setDefaultValue: Boolean = true)(implicit ec: ExecutionContext, oec: OntologyEngineContext): Future[List[Node]] = {
val objectType = metadata.getOrDefault("objectType", "").asInstanceOf[String]
metadata.remove("objectType")
val identifier: String = Identifier.getIdentifier(HierarchyConstants.TAXONOMY_ID, Identifier.getUniqueIdFromTimestamp)
idMap += (nodeId -> identifier)
metadata.put(HierarchyConstants.IDENTIFIER, identifier)
Expand Down Expand Up @@ -269,6 +270,7 @@ object UpdateHierarchyManager {
if (neo4jCreateTypes.contains(objectType)) {
createRequest.getContext.put(HierarchyConstants.IDENTIFIER, tempNode.getIdentifier)
createRequest.getContext.put(HierarchyConstants.SCHEMA_NAME, "question")
createRequest.getContext.put(HierarchyConstants.OBJECT_TYPE, objectType)
DataNode.update(createRequest).map(node => {
idMap += (nodeId -> node.getIdentifier)
updateNodeList(nodeList, node.getIdentifier, node.getMetadata)
Expand Down Expand Up @@ -400,7 +402,8 @@ object UpdateHierarchyManager {
} else {
getQuestionNode(id, HierarchyConstants.TAXONOMY_ID).map(node => {
populateHierarchyRelatedData(node, depth, index, parent)
node.getMetadata.put(HierarchyConstants.VISIBILITY, HierarchyConstants.DEFAULT)
//node.getMetadata.put(HierarchyConstants.VISIBILITY, HierarchyConstants.DEFAULT)
node.setObjectType(HierarchyConstants.QUESTION_OBJECT_TYPE)
node.getMetadata.put(HierarchyConstants.OBJECT_TYPE, HierarchyConstants.QUESTION_OBJECT_TYPE)
val nxtEnrichedNodeList = node :: enrichedNodeList
if (MapUtils.isNotEmpty(hierarchyStructure.getOrDefault(id, Map[String, Int]()))) {
Expand Down
16 changes: 4 additions & 12 deletions build/assessment-service/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ node('build-slave') {
} else
println(ANSI_BOLD + ANSI_GREEN + "Found environment variable named hub_org with value as: " + hub_org + ANSI_NORMAL)
}

cleanWs()
if (params.github_release_tag == "") {
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
branch_name = sh(script: 'git name-rev --name-only HEAD | rev | cut -d "/" -f1| rev', returnStdout: true).trim()
build_tag = branch_name + "_" + commit_hash + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag not specified, using the latest commit hash: " + commit_hash + ANSI_NORMAL)
} else {
def scmVars = checkout scm
checkout scm: [$class: 'GitSCM', branches: [[name: "refs/tags/$params.github_release_tag"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]]
build_tag = params.github_release_tag + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from tag: " + params.github_release_tag + ANSI_NORMAL)
}
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
build_tag = sh(script: "echo " + params.github_release_tag.split('/')[-1] + "_" + commit_hash + "_" + env.BUILD_NUMBER, returnStdout: true).trim()
echo "build_tag: " + build_tag

stage('Build') {
Expand Down
2 changes: 1 addition & 1 deletion build/content-service/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ node('build-slave') {
} else
println(ANSI_BOLD + ANSI_GREEN + "Found environment variable named hub_org with value as: " + hub_org + ANSI_NORMAL)
}

cleanWs()
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
Expand Down
16 changes: 4 additions & 12 deletions build/search-service/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ node('build-slave') {
} else
println(ANSI_BOLD + ANSI_GREEN + "Found environment variable named hub_org with value as: " + hub_org + ANSI_NORMAL)
}

cleanWs()
if (params.github_release_tag == "") {
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
branch_name = sh(script: 'git name-rev --name-only HEAD | rev | cut -d "/" -f1| rev', returnStdout: true).trim()
build_tag = branch_name + "_" + commit_hash + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag not specified, using the latest commit hash: " + commit_hash + ANSI_NORMAL)
} else {
def scmVars = checkout scm
checkout scm: [$class: 'GitSCM', branches: [[name: "refs/tags/$params.github_release_tag"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]]
build_tag = params.github_release_tag + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from tag: " + params.github_release_tag + ANSI_NORMAL)
}
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
build_tag = sh(script: "echo " + params.github_release_tag.split('/')[-1] + "_" + commit_hash + "_" + env.BUILD_NUMBER, returnStdout: true).trim()
echo "build_tag: " + build_tag

stage('Build') {
Expand Down
16 changes: 4 additions & 12 deletions build/taxonomy-service/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ node('build-slave') {
} else
println(ANSI_BOLD + ANSI_GREEN + "Found environment variable named hub_org with value as: " + hub_org + ANSI_NORMAL)
}

cleanWs()
if (params.github_release_tag == "") {
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
branch_name = sh(script: 'git name-rev --name-only HEAD | rev | cut -d "/" -f1| rev', returnStdout: true).trim()
build_tag = branch_name + "_" + commit_hash + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag not specified, using the latest commit hash: " + commit_hash + ANSI_NORMAL)
} else {
def scmVars = checkout scm
checkout scm: [$class: 'GitSCM', branches: [[name: "refs/tags/$params.github_release_tag"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]]
build_tag = params.github_release_tag + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from tag: " + params.github_release_tag + ANSI_NORMAL)
}
checkout scm
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
build_tag = sh(script: "echo " + params.github_release_tag.split('/')[-1] + "_" + commit_hash + "_" + env.BUILD_NUMBER, returnStdout: true).trim()
echo "build_tag: " + build_tag

stage('Build') {
Expand Down
Loading

0 comments on commit f6e7fbf

Please sign in to comment.