override fun convert()

in intellij-plugin/educational-core/src/com/jetbrains/edu/learning/serialization/converter/json/ToSeventhVersionJsonStepOptionConverter.kt [16:37]


  override fun convert(stepOptionsJson: ObjectNode): ObjectNode {
    if (stepOptionsJson.get(TITLE)?.asText() == EduNames.ADDITIONAL_MATERIALS) return stepOptionsJson

    val taskFiles = stepOptionsJson.get(FILES) ?: ObjectMapper().createArrayNode()
    val testFiles = stepOptionsJson.get(TESTS) ?: ObjectMapper().createArrayNode()

    if (taskFiles.any{ it.get(NAME).asText().endsWith(".py") }) return stepOptionsJson
    if (testFiles.any{ it.get(NAME).asText().endsWith(".py") }) return stepOptionsJson

    for (taskFile in taskFiles) {
      if (taskFile !is ObjectNode) continue
      convertTaskFile(taskFile, "src")
    }

    for (testFile in testFiles) {
      if (testFile !is ObjectNode) continue
      val path = testFile.get(NAME)?.asText() ?: continue
      testFile.put(NAME, "test/$path")
    }

    return stepOptionsJson
  }