Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
knowledge-platform
Commits
4dee3846
Unverified
Commit
4dee3846
authored
1 year ago
by
Shishir Suman
Committed by
GitHub
1 year ago
Browse files
Options
Download
Plain Diff
Merge pull request #11 from rahulbowade/Gcloud_fix
Added code with Constants values
parents
8013fb28
c598e5b6
Gcloud_fix
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
assessment-api/assessment-service/app/controllers/v4/QuestionController.scala
+1
-0
...sment-service/app/controllers/v4/QuestionController.scala
assessment-api/assessment-service/app/handlers/QuestionExcelParser.scala
+36
-33
...assessment-service/app/handlers/QuestionExcelParser.scala
assessment-api/assessment-service/app/utils/Constants.java
+28
-4
assessment-api/assessment-service/app/utils/Constants.java
with
65 additions
and
37 deletions
+65
-37
assessment-api/assessment-service/app/controllers/v4/QuestionController.scala
+
1
−
0
View file @
4dee3846
...
...
@@ -150,6 +150,7 @@ class QuestionController @Inject()(@Named(ActorNames.QUESTION_ACTOR) questionAct
logger
.
info
(
"questions after parsing "
+
questions
)
val
futures
=
questions
.
get
.
map
(
question
=>
{
val
headers
=
commonHeaders
(
request
.
headers
)
headers
.
put
(
"channel"
,
question
.
get
(
"channel"
))
question
.
putAll
(
headers
)
logger
.
info
(
"put headers "
+
headers
)
logger
.
info
(
"creating question := {}"
,
questions
.
toString
)
...
...
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/handlers/QuestionExcelParser.scala
+
36
−
33
View file @
4dee3846
...
...
@@ -52,29 +52,29 @@ object QuestionExcelParser {
def
buildDefaultQuestion
()
=
{
val
defaultQuestion
=
new
java
.
util
.
HashMap
().
asInstanceOf
[
java.util.Map
[
String
,
AnyRef
]]
defaultQuestion
.
put
(
"code"
,
"question"
)
defaultQuestion
.
put
(
"mimeType"
,
"application/vnd.sunbird.question"
)
defaultQuestion
.
put
(
"objectType"
,
"Question"
)
defaultQuestion
.
put
(
"primaryCategory"
,
"Multiple Choice Question"
)
defaultQuestion
.
put
(
"qType"
,
"MCQ"
)
defaultQuestion
.
put
(
"name"
,
"Question"
)
defaultQuestion
.
put
(
Constants
.
CODE
,
"question"
)
defaultQuestion
.
put
(
Constants
.
MIME_TYPE
,
"application/vnd.sunbird.question"
)
defaultQuestion
.
put
(
Constants
.
OBJECT_TYPE
,
"Question"
)
defaultQuestion
.
put
(
Constants
.
PRIMARY_CATEGORY
,
"Multiple Choice Question"
)
defaultQuestion
.
put
(
Constants
.
QTYPE
,
"MCQ"
)
defaultQuestion
.
put
(
Constants
.
NAME
,
"Question"
)
defaultQuestion
}
def
buildOptionMap
(
option
:
String
,
level
:
Integer
,
answer
:
Boolean
)
=
{
val
mapOptionValue
=
new
java
.
util
.
HashMap
().
asInstanceOf
[
java.util.Map
[
String
,
AnyRef
]]
mapOptionValue
.
put
(
"body"
,
option
)
mapOptionValue
.
put
(
"value"
,
level
)
mapOptionValue
.
put
(
Constants
.
BODY
,
option
)
mapOptionValue
.
put
(
Constants
.
VALUE
,
level
)
val
mapOption
=
new
java
.
util
.
HashMap
().
asInstanceOf
[
java.util.Map
[
String
,
AnyRef
]]
mapOption
.
put
(
"answer"
,
answer
.
asInstanceOf
[
AnyRef
])
mapOption
.
put
(
"value"
,
mapOptionValue
)
mapOption
.
put
(
Constants
.
ANSWER
,
answer
.
asInstanceOf
[
AnyRef
])
mapOption
.
put
(
Constants
.
VALUE
,
mapOptionValue
)
mapOption
}
def
buildInteractionMap
(
option
:
String
,
level
:
Integer
)
=
{
val
mapOptionValue
=
new
java
.
util
.
HashMap
().
asInstanceOf
[
java.util.Map
[
String
,
AnyRef
]]
mapOptionValue
.
put
(
"label"
,
option
)
mapOptionValue
.
put
(
"value"
,
level
)
mapOptionValue
.
put
(
Constants
.
LABEL
,
option
)
mapOptionValue
.
put
(
Constants
.
VALUE
,
level
)
mapOptionValue
}
...
...
@@ -113,6 +113,8 @@ object QuestionExcelParser {
val
questionText
=
rowContent
.
apply
(
7
)
val
answer
=
rowContent
.
apply
(
9
).
trim
val
board
=
rowContent
.
apply
(
11
).
trim
val
channel
=
rowContent
.
apply
(
12
).
trim
val
maxScore
=
rowContent
.
apply
(
13
).
trim
var
i
=
-
1
...
...
@@ -135,16 +137,16 @@ object QuestionExcelParser {
val
optText
=
option
.
apply
(
1
).
trim
j
+=
1
if
(
isOptionAnswer
(
optSeq
,
answer
)){
mapRepsonse
.
put
(
"
maxScore
"
,
1
.
asInstanceOf
[
AnyRef
])
mapRepsonse
.
put
(
"cardinality"
,
"single"
)
mapRepsonse
.
put
(
"type"
,
"integer"
)
mapRepsonse
.
put
(
Constants
.
MAX_SCORE
,
maxScore
.
asInstanceOf
[
AnyRef
])
mapRepsonse
.
put
(
Constants
.
CARDINALITY
,
"single"
)
mapRepsonse
.
put
(
Constants
.
TYPE
,
"integer"
)
val
mapCorrectResponse
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
mapCorrectResponse
.
put
(
"value"
,
String
.
valueOf
(
j
))
mapCorrectResponse
.
put
(
Constants
.
VALUE
,
String
.
valueOf
(
j
))
val
mapOutcomes
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
mapOutcomes
.
put
(
"
SCORE
"
,
1
.
asInstanceOf
[
AnyRef
])
mapCorrectResponse
.
put
(
"outcomes"
,
mapOutcomes
)
mapRepsonse
.
put
(
"correctResponse"
,
mapCorrectResponse
)
mapRepsonse
.
put
(
"mapping"
,
new
util
.
ArrayList
())
mapOutcomes
.
put
(
Constants
.
SCORE
,
maxScore
.
asInstanceOf
[
AnyRef
])
mapCorrectResponse
.
put
(
Constants
.
OUTCOMES
,
mapOutcomes
)
mapRepsonse
.
put
(
Constants
.
CORRECT_RESPONSE
,
mapCorrectResponse
)
mapRepsonse
.
put
(
Constants
.
MAPPING
,
new
util
.
ArrayList
())
}
repsonse1
.
put
(
"response1"
,
mapRepsonse
)
repsonse1
...
...
@@ -164,34 +166,35 @@ object QuestionExcelParser {
val
editorState
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
val
interactionTypes
=
new
util
.
ArrayList
[
String
]()
interactionTypes
.
add
(
"choice"
)
question
.
put
(
"board"
,
board
)
question
.
put
(
"interactionTypes"
,
interactionTypes
)
question
.
put
(
"interactions"
,
mapInteraction
)
question
.
put
(
"responseDeclaration"
,
repsonse1
)
question
.
put
(
Constants
.
BOARD
,
board
)
question
.
put
(
Constants
.
INTERACTION_TYPES
,
interactionTypes
)
question
.
put
(
Constants
.
INTERACTIONS
,
mapInteraction
)
question
.
put
(
Constants
.
RESPONSE_DECLARATION
,
repsonse1
)
setArrayValue
(
question
,
medium
,
Constants
.
medium
)
setArrayValue
(
question
,
subject
,
Constants
.
subject
)
setArrayValue
(
question
,
gradeLevel
,
Constants
.
gradeLevel
)
setArrayValue
(
question
,
difficultyLevel
,
Constants
.
difficultyLevel
)
editorState
.
put
(
"options"
,
options
)
editorState
.
put
(
"question"
,
questionText
)
editorState
.
put
(
Constants
.
OPTIONS
,
options
)
editorState
.
put
(
Constants
.
QUESTION
,
questionText
)
logger
.
info
(
"Inside the parseQuestion"
)
question
.
put
(
"body"
,
questionText
)
question
.
put
(
"editorState"
,
editorState
)
question
.
put
(
"templateId"
,
"mcq-vertical"
)
question
.
put
(
"answer"
,
answer
)
question
.
put
(
Constants
.
BODY
,
questionText
)
question
.
put
(
Constants
.
EDITOR_STATE
,
editorState
)
question
.
put
(
Constants
.
TEMPLATE_ID
,
"mcq-vertical"
)
question
.
put
(
Constants
.
ANSWER
,
answer
)
question
.
put
(
"channel"
,
channel
)
question
}
private
def
createInteractionMap
(
interactionOptions
:
util.ArrayList
[
util.Map
[
String
,
AnyRef
]])
=
{
val
mapOption
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
mapOption
.
put
(
"type"
,
"choice"
.
asInstanceOf
[
AnyRef
])
mapOption
.
put
(
"options"
,
interactionOptions
)
mapOption
.
put
(
Constants
.
TYPE
,
"choice"
.
asInstanceOf
[
AnyRef
])
mapOption
.
put
(
Constants
.
OPTIONS
,
interactionOptions
)
val
mapValidation
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
mapValidation
.
put
(
"required"
,
"Yes"
.
asInstanceOf
[
AnyRef
])
val
mapInteraction
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
mapInteraction
.
put
(
"response1"
,
mapOption
)
mapInteraction
.
put
(
"validation"
,
mapValidation
)
mapInteraction
.
put
(
Constants
.
VALIDATION
,
mapValidation
)
mapInteraction
}
...
...
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/utils/Constants.java
+
28
−
4
View file @
4dee3846
...
...
@@ -4,14 +4,38 @@ package utils;
public
class
Constants
{
public
static
String
MCQ
=
"MCQ"
;
public
static
String
MCQ_SINGLE_SELECT
=
"Single select"
;
public
static
String
MATCH_THE_FOLLOWING
=
"Match the following"
;
public
static
String
MTF
=
"MTF"
;
public
static
String
FITB
=
"Fill in the blanks"
;
public
static
String
GNM
=
"GNM"
;
public
static
String
GENERAL_NURSING_MIDWIFERY
=
"General Nursing Midwifery"
;
public
static
String
ANM
=
"ANM"
;
public
static
String
medium
=
"medium"
;
public
static
String
MAX_SCORE
=
"maxScore"
;
public
static
String
CARDINALITY
=
"cardinality"
;
public
static
String
TYPE
=
"type"
;
public
static
String
SINGLE
=
"single"
;
public
static
String
MULTIPLE
=
"multiple"
;
public
static
String
VALUE
=
"value"
;
public
static
String
SCORE
=
"SCORE"
;
public
static
String
OUTCOMES
=
"outcomes"
;
public
static
String
CORRECT_RESPONSE
=
"correctResponse"
;
public
static
String
MAPPING
=
"mapping"
;
public
static
String
LABEL
=
"label"
;
public
static
String
BODY
=
"body"
;
public
static
String
ANSWER
=
"answer"
;
public
static
String
BOARD
=
"board"
;
public
static
String
INTERACTION_TYPES
=
"interactionTypes"
;
public
static
String
INTERACTIONS
=
"interactions"
;
public
static
String
RESPONSE_DECLARATION
=
"responseDeclaration"
;
public
static
String
OPTIONS
=
"options"
;
public
static
String
QUESTION
=
"question"
;
public
static
String
EDITOR_STATE
=
"editorState"
;
public
static
String
TEMPLATE_ID
=
"templateId"
;
public
static
String
VALIDATION
=
"validation"
;
public
static
String
CODE
=
"code"
;
public
static
String
MIME_TYPE
=
"mimeType"
;
public
static
String
OBJECT_TYPE
=
"objectType"
;
public
static
String
PRIMARY_CATEGORY
=
"primaryCategory"
;
public
static
String
QTYPE
=
"qType"
;
public
static
String
NAME
=
"name"
;
public
static
String
subject
=
"subject"
;
public
static
String
gradeLevel
=
"gradeLevel"
;
public
static
String
difficultyLevel
=
"difficultyLevel"
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets