Skip to content

Commit

Permalink
Shared: Decrease wrong submission count for skip suggestion (#1168)
Browse files Browse the repository at this point in the history
^ALTAPPS-1343
  • Loading branch information
ivan-magda authored Aug 28, 2024
1 parent fa70292 commit 52713f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import org.hyperskill.app.submissions.domain.model.formattedText
class StepQuizFeedbackMapper(private val resourcesProvider: ResourceProvider) {

companion object {
private const val SEE_HINT_SUGGESTION_THRESHOLD = 2
private const val SKIP_SUGGESTION_THRESHOLD = 4
private const val SEE_HINT_SUGGESTION_THRESHOLD = 1
private const val SKIP_SUGGESTION_THRESHOLD = 2
}

fun map(state: StepQuizFeature.State): StepQuizFeedbackState =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ class StepQuizFeedbackMapperTest {
}

@Test
fun `Second wrong submission should trigger Wrong viewState with SEE_HINT actionType when hint is not opened`() {
fun `First wrong submission should trigger Wrong viewState with SEE_HINT actionType when hint is not opened`() {
val stepId = 0L
val state = getAttemptLoadedSubmissionState(
step = Step.stub(id = stepId),
submission = Submission.stub(
status = SubmissionStatus.WRONG,
),
wrongSubmissionCount = 2,
wrongSubmissionCount = 1,
stepQuizHintsState = StepQuizHintsFeature.State.Content(
hintsIds = listOf(0, 1, 2),
currentHint = null,
Expand All @@ -189,7 +189,7 @@ class StepQuizFeedbackMapperTest {

/*ktlint-disable*/
@Test
fun `Second wrong submission should trigger Wrong viewState with READ_COMMENTS actionType when hint is opened and there are comments`() {
fun `First wrong submission should trigger Wrong viewState with READ_COMMENTS actionType when hint is opened and there are comments`() {
val stepId = 0L
val state = getAttemptLoadedSubmissionState(
step = Step.stub(
Expand All @@ -204,7 +204,7 @@ class StepQuizFeedbackMapperTest {
submission = Submission.stub(
status = SubmissionStatus.WRONG,
),
wrongSubmissionCount = 2,
wrongSubmissionCount = 1,
stepQuizHintsState = StepQuizHintsFeature.State.Content(
hintsIds = listOf(0, 1, 2),
currentHint = Comment.stub(id = 0),
Expand All @@ -222,7 +222,7 @@ class StepQuizFeedbackMapperTest {

/*ktlint-disable*/
@Test
fun `Second wrong submission should trigger Wrong viewState with null actionType when hint is opened and no comments available`() {
fun `First wrong submission should trigger Wrong viewState with null actionType when hint is opened and no comments available`() {
val stepId = 0L
val state = getAttemptLoadedSubmissionState(
step = Step.stub(
Expand All @@ -232,7 +232,7 @@ class StepQuizFeedbackMapperTest {
submission = Submission.stub(
status = SubmissionStatus.WRONG,
),
wrongSubmissionCount = 2,
wrongSubmissionCount = 1,
stepQuizHintsState = StepQuizHintsFeature.State.Content(
hintsIds = listOf(0, 1, 2),
currentHint = Comment.stub(id = 0),
Expand All @@ -249,14 +249,14 @@ class StepQuizFeedbackMapperTest {
}

@Test
fun `4th wrong submission should trigger Wrong viewState with SKIP_PROBLEM action type`() {
fun `Second wrong submission should trigger Wrong viewState with SKIP_PROBLEM action type`() {
val stepId = 0L
val state = getAttemptLoadedSubmissionState(
step = Step.stub(id = stepId),
submission = Submission.stub(
status = SubmissionStatus.WRONG,
),
wrongSubmissionCount = 4
wrongSubmissionCount = 2
)

val viewState = mapper.map(state)
Expand Down

0 comments on commit 52713f5

Please sign in to comment.