-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added subjectareas to the GYS and VUXGYS schooltypes to that the stru…
…cture aligns with GRS.
- Loading branch information
Stefan Jonasson
authored and
Stefan Jonasson
committed
Nov 29, 2019
1 parent
b433455
commit 1cc70c3
Showing
7 changed files
with
105 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/kotlin/org/edtech/curriculum/internal/VuxSubjectAreaDataExtractor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.edtech.curriculum.internal | ||
|
||
import org.edtech.curriculum.CourseHtml | ||
import org.edtech.curriculum.GradeStep | ||
import org.edtech.curriculum.RequirementGroup | ||
import org.jsoup.nodes.Document | ||
import org.jsoup.select.Elements | ||
|
||
|
||
/** | ||
* Parses the course data in the format supplied in syllabus.tgz | ||
* | ||
* Extracts the information to be used for processing | ||
* | ||
* | ||
* @param subjectDocument to extract information from | ||
*/ | ||
class VuxSubjectAreaDataExtractor(private val subjectDocument: Document): CourseDataExtractor { | ||
|
||
override fun getCourseData(): List<CourseHtml> { | ||
return listOf(CourseHtml( | ||
subjectDocument.select("name").text(), | ||
subjectDocument.select("description").text().removePrefix("<p>").removeSuffix("</p>"), | ||
subjectDocument.select("code").text(), | ||
subjectDocument.select("category").text(), | ||
"", | ||
subjectDocument.select("point").text(), | ||
convertDashListToList(subjectDocument.select("centralContents text").text()), | ||
this.getKnowledgeRequirements(subjectDocument.select("knowledgeRequirements")))) | ||
} | ||
|
||
|
||
private fun getKnowledgeRequirements(knowledgeRequirementElements: Elements): List<RequirementGroup> { | ||
return listOf(RequirementGroup(knowledgeRequirementElements.map { | ||
Pair( | ||
GradeStep.valueOf(it.selectFirst("typeOfRequirement").text()), | ||
it.selectFirst("text").text() | ||
) | ||
}.toMap())) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters