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
8efa0e58
Commit
8efa0e58
authored
1 year ago
by
Rahul Bowade
Browse files
Options
Download
Patches
Plain Diff
Add code changes related to subject, medium and other fraccl
parent
ff01b604
Gcloud_fix
1 merge request
!13
Add code changes related to subject, medium and other fraccl
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assessment-api/assessment-service/app/handlers/QuestionExcelParser.scala
+21
-21
...assessment-service/app/handlers/QuestionExcelParser.scala
assessment-api/assessment-service/app/utils/Constants.java
+1
-0
assessment-api/assessment-service/app/utils/Constants.java
with
22 additions
and
21 deletions
+22
-21
assessment-api/assessment-service/app/handlers/QuestionExcelParser.scala
+
21
−
21
View file @
8efa0e58
...
...
@@ -18,7 +18,7 @@ object QuestionExcelParser {
def
getQuestions
(
fileName
:
String
,
file
:
File
)
=
{
try
{
val
workbook
=
new
XSSFWorkbook
(
new
FileInputStream
(
file
))
val
sheets
=
(
2
until
workbook
.
getNumberOfSheets
).
map
(
index
=>
workbook
.
getSheetAt
(
index
))
// iterates over the excelsheet
val
sheets
=
(
0
until
workbook
.
getNumberOfSheets
).
map
(
index
=>
workbook
.
getSheetAt
(
index
))
// iterates over the excelsheet
sheets
.
flatMap
(
sheet
=>
{
logger
.
info
(
"Inside the getQuestions"
)
(
1
until
sheet
.
getPhysicalNumberOfRows
)
// iterates over each row in the sheet
...
...
@@ -27,12 +27,11 @@ object QuestionExcelParser {
// matching the row value to determine the value of objects
oRow
match
{
case
Some
(
x
)
=>
{
val
questionType
=
sheet
.
getRow
(
rowNum
).
getCell
(
10
)
val
isMCQ
=
questionType
.
toString
.
trim
.
equalsIgnoreCase
(
Constants
.
MCQ
)
||
(
questionType
.
toString
.
trim
.
startsWith
(
Constants
.
MCQ
)
||
questionType
.
toString
.
trim
.
endsWith
(
Constants
.
MCQ
))
// checks questionType is MCQ
val
questionType
=
sheet
.
getRow
(
rowNum
).
getCell
(
11
)
val
isMCQ
=
questionType
.
toString
.
trim
.
equalsIgnoreCase
(
Constants
.
MCQ_SINGLE_SELECT
)
// checks questionType is MCQ
//val isMTF = Constants.MTF.equals(questionType.toString) || Constants.MATCH_THE_FOLLOWING.equals(questionType.toString)
//val isFITB = Constants.FITB.equals(questionType.toString)
val
answerCell
=
sheet
.
getRow
(
rowNum
).
getCell
(
9
)
val
answerCell
=
sheet
.
getRow
(
rowNum
).
getCell
(
10
)
val
isAnswerNotBlank
=
answerCell
.
getCellType
()
!=
CellType
.
BLANK
//isMCQ || isMTF || isFITB && isAnswerNotBlank
isMCQ
&&
isAnswerNotBlank
...
...
@@ -102,23 +101,23 @@ object QuestionExcelParser {
.
map
(
colId
=>
Option
(
xssFRow
.
getCell
(
colId
)).
getOrElse
(
""
).
toString
).
toList
//fetches data from sheet
// this is the role(medium)
val
medium
=
rowContent
.
apply
(
0
)
// this is competency label
val
medium
=
rowContent
.
apply
(
2
)
// this is the role(subject)
val
subject
=
rowContent
.
apply
(
0
)
val
subject
=
rowContent
.
apply
(
1
)
// this val is for competency level label
val
difficultyLevel
=
rowContent
.
apply
(
4
)
val
difficultyLevel
=
rowContent
.
apply
(
5
)
// this val is for activity(GradeLevel)
val
gradeLevel
=
rowContent
.
apply
(
6
)
val
questionText
=
rowContent
.
apply
(
7
)
val
answer
=
rowContent
.
apply
(
9
).
trim
val
board
=
rowContent
.
apply
(
1
1
).
trim
val
channel
=
rowContent
.
apply
(
1
2
).
trim
val
maxScore
:
Integer
=
rowContent
.
apply
(
1
3
).
trim
.
toDouble
.
intValue
()
val
gradeLevel
=
rowContent
.
apply
(
7
)
val
questionText
=
rowContent
.
apply
(
8
)
val
answer
=
rowContent
.
apply
(
10
).
trim
val
board
=
rowContent
.
apply
(
1
2
).
trim
val
channel
=
rowContent
.
apply
(
1
3
).
trim
val
maxScore
:
Integer
=
rowContent
.
apply
(
1
4
).
trim
.
toDouble
.
intValue
()
var
i
=
-
1
val
options
=
new
util
.
ArrayList
[
util.Map
[
String
,
AnyRef
]](
rowContent
.
apply
(
8
).
split
(
"\n"
).
filter
(
StringUtils
.
isNotBlank
).
map
(
o
=>
{
val
options
=
new
util
.
ArrayList
[
util.Map
[
String
,
AnyRef
]](
rowContent
.
apply
(
9
).
split
(
"\n"
).
filter
(
StringUtils
.
isNotBlank
).
map
(
o
=>
{
val
option
=
o
.
split
(
"[.).]"
).
toList
val
optSeq
=
option
.
apply
(
0
).
trim
...
...
@@ -130,7 +129,7 @@ object QuestionExcelParser {
var
j
=
-
1
val
mapRepsonse
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
val
repsonse1
=
new
util
.
HashMap
().
asInstanceOf
[
util.Map
[
String
,
AnyRef
]]
val
responseDeclarationOption
=
new
util
.
ArrayList
[
util.Map
[
String
,
AnyRef
]](
rowContent
.
apply
(
8
).
split
(
"\n"
).
filter
(
StringUtils
.
isNotBlank
).
map
(
o
=>
{
val
responseDeclarationOption
=
new
util
.
ArrayList
[
util.Map
[
String
,
AnyRef
]](
rowContent
.
apply
(
9
).
split
(
"\n"
).
filter
(
StringUtils
.
isNotBlank
).
map
(
o
=>
{
val
option
=
o
.
split
(
"[.).]"
).
toList
val
optSeq
=
option
.
apply
(
0
).
trim
...
...
@@ -153,7 +152,7 @@ object QuestionExcelParser {
}).
toList
.
asJava
)
var
k
=
-
1
val
interactionOptions
=
new
util
.
ArrayList
[
util.Map
[
String
,
AnyRef
]](
rowContent
.
apply
(
8
).
split
(
"\n"
).
filter
(
StringUtils
.
isNotBlank
).
map
(
o
=>
{
val
interactionOptions
=
new
util
.
ArrayList
[
util.Map
[
String
,
AnyRef
]](
rowContent
.
apply
(
9
).
split
(
"\n"
).
filter
(
StringUtils
.
isNotBlank
).
map
(
o
=>
{
val
option
=
o
.
split
(
"[.).]"
).
toList
val
optSeq
=
option
.
apply
(
0
).
trim
...
...
@@ -198,9 +197,10 @@ object QuestionExcelParser {
mapInteraction
}
private
def
setArrayValue
(
question
:
util.Map
[
String
,
AnyRef
],
medium
:
String
,
questionKey
:
String
)
=
{
val
valueList
=
new
util
.
ArrayList
[
String
]();
valueList
.
add
(
medium
);
private
def
setArrayValue
(
question
:
util.Map
[
String
,
AnyRef
],
data
:
String
,
questionKey
:
String
)
=
{
val
dataArray
=
data
.
split
(
"[|]"
)
val
valueList
=
new
util
.
ArrayList
[
String
]()
dataArray
.
toStream
.
foreach
(
list
=>
valueList
.
add
(
list
.
trim
))
question
.
put
(
questionKey
,
valueList
)
}
}
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/utils/Constants.java
+
1
−
0
View file @
8efa0e58
...
...
@@ -4,6 +4,7 @@ package utils;
public
class
Constants
{
public
static
String
MCQ
=
"MCQ"
;
public
static
String
MCQ_SINGLE_SELECT
=
"MCQ SINGLE SELECT"
;
public
static
String
MATCH_THE_FOLLOWING
=
"Match the following"
;
public
static
String
MTF
=
"MTF"
;
public
static
String
FITB
=
"Fill in the blanks"
;
...
...
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