Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Question Stash and Session Manager): Add question stash and fetch strategy, added a Session Manager. #63

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

fingerson
Copy link
Collaborator

@fingerson fingerson commented May 31, 2022

  • Created QuestionStash Singleton Class

    • Public methods:
    • public func isRepeatedQuestion(question: String) -> Bool
    • public func addQuestion(question: String, answerStatus: Bool = true)
    • Stash stores the last 5000 answered questions.
  • Removed AnswerTracker class (incorporated into SessionManager).

  • Added SessionManager Singleton Class:

    • Public methods:
    • func startSession(
      category: Manager.API.QuestionCategory,
      difficulty: Manager.API.Difficulty,
      answerType: Manager.API.AnswerTypes,
      amount: Int = 10
      ) async throws -> Bool
    • func sessionEnded() -> Bool
    • func currentQuestion() throws -> Question
    • func addResult(answerStatus: Bool) throws
  • Modified API to include new methods:

    • fetchQuestions renamed to simpleFetch
    • added new method fetchQuestions which checks if a question is repeated and repeats the API call until the asked number of questions is obtained without repetition.
  • Modified QuestionView and InitialView to work with session manager.

  • InitialView had data inside the view, passed it to ViewModel.

  • Bug identified on both this branch and dev: Switching to the profile tab and then back to the quiz tab during a quiz session will cause weird behaviors. Added to issues.

Closes #11 ans #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] Fetch questions strategy
1 participant