Merge branch 'tibor' into 'master'

API 1.0.35+2 tutorial_step condition as JSON

See merge request bossanyit/aitrainer_server!55
This commit is contained in:
Bossányi Tibor 2021-04-30 21:02:55 +00:00
commit dab780e9fe
4 changed files with 6 additions and 20 deletions

View File

@ -1394,14 +1394,10 @@ CREATE TABLE `tutorial_steps` (
`tutorial_id` INT(11) NOT NULL DEFAULT '0',
`step` INT(3) NOT NULL DEFAULT '0',
`tutorial_text` TEXT NOT NULL COLLATE 'utf8_hungarian_ci',
`error_text` TEXT NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
`check_text` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
`condition` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
`parent` INT(3) NOT NULL DEFAULT '0',
`action` TINYINT NULL DEFAULT '0',
`condition` TEXT NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
PRIMARY KEY (`tutorial_step_id`) USING BTREE,
INDEX `tutorial_id` (`tutorial_id`) USING BTREE,
INDEX `parent` (`parent`) USING BTREE
INDEX `tutorial_id` (`tutorial_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB

View File

@ -13,12 +13,8 @@ data class TutorialSteps (
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var tutorialStepId: Long = 0,
@Expose @get: NotBlank var tutorialText: String = "",
@Expose @get: NotBlank var step: Int = 0,
@Expose var direction: String? = null,
@Expose var checkText: String? = null,
@Expose var condition: String? = null,
@Expose var branch: String? = null,
@Expose @get: NotBlank var parent_id: Int = 0,
@Expose var action: Int? = 0,
) {
@ManyToOne(fetch = FetchType.LAZY, optional = false)

View File

@ -11,7 +11,6 @@ data class TutorialTranslation (
@Expose @get: NotBlank var languageCode: String?,
@Expose @get: NotBlank var tutorialText: String = "",
@Expose var errorText: String? = null,
) {
@ManyToOne(fetch = FetchType.LAZY, optional = false)

View File

@ -133,16 +133,11 @@ class AppPackageTest {
val tutorialJson: String = record[1]
val type = object : TypeToken<List<Tutorial?>?>() {}.type
val tutorials: List<Tutorial> = gson.fromJson(tutorialJson, type)
assertEquals(tutorials.size, 1)
assertEquals(tutorials.size, 2)
assertEquals(tutorials[0].name, "Basic")
assertEquals(tutorials[0].steps.size, 5)
assertEquals(tutorials[0].steps[3].parent_id, 2)
assertEquals(tutorials[0].steps[3].condition, "Check2")
assertEquals(tutorials[0].steps[2].direction, "up|88")
assertEquals(tutorials[0].steps[3].action, 0)
assertEquals(tutorials[0].steps[4].action, 1)
assertEquals(tutorials[0].steps[4].branch, "Check1")
assertEquals(tutorials[0].steps[0].translations.size, 2)
assertEquals(tutorials[0].steps.size, 9)
assertEquals(tutorials[0].steps[2].condition, "{\"direction\":\"down\",\"top\":95,\"left\":-1,\"show_bubble\":false,\"bubble_x\":220,\"bubble_y\":220,\"bubble_width\":440,\"bubble_height\":440,\"show_check_text\":false,\"parent\":2}")
assertEquals(tutorials[0].steps[0].translations.size, 1)
}
}