Commit 6b13e2bb authored by Rahul Bowade's avatar Rahul Bowade
Browse files

Adding primaryCategory MCQ

Showing with 6 additions and 3 deletions
+6 -3
......@@ -6,15 +6,18 @@ import org.apache.poi.xssf.usermodel.{XSSFRow, XSSFWorkbook}
import java.io.{File, FileInputStream}
import java.util
import scala.collection.JavaConverters._
import org.slf4j.{Logger, LoggerFactory}
import org.sunbird.cache.impl.RedisCache
object QuestionExcelParser {
private val logger: Logger = LoggerFactory.getLogger(RedisCache.getClass.getCanonicalName)
def getQuestions(file: File) = {
try {
val workbook = new XSSFWorkbook(new FileInputStream(file))
val sheet = workbook.getSheetAt(0)
logger.info("Inside the getQuestions")
(1 until sheet.getPhysicalNumberOfRows)
.filter(rowNum => {
val oRow = Option(sheet.getRow(rowNum))
......@@ -39,7 +42,7 @@ object QuestionExcelParser {
defaultQuestion.put("code", "question")
defaultQuestion.put("mimeType", "application/vnd.sunbird.question")
defaultQuestion.put("objectType", "Question")
defaultQuestion.put("primaryCategory", "MTF Question")
defaultQuestion.put("primaryCategory", "MCQ Question")
defaultQuestion.put("qType", "MCQ")
defaultQuestion.put("name", "Question")
defaultQuestion
......@@ -85,7 +88,7 @@ object QuestionExcelParser {
val editorState = new java.util.HashMap().asInstanceOf[java.util.Map[String, AnyRef]]
editorState.put("options", options)
editorState.put("question", questionText)
logger.info("Inside the parseQuestion")
question.put("body", questionText)
question.put("editorState", editorState)
question
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment