Bang Implementation#3
Open
andrewlinington wants to merge 7 commits into
Open
Conversation
…n task to remove an error when resetting the timer.
…streak has ended for the given day and a way to keep track of the users current streak.
…nto spring to run code to check for a users bang streak during the given day. Updated the README.md to include usages for both the database and property file.
… Removed all unused imports. moved BangCache.kt and BangResult.kt into their respective files in Service.
andrewlinington
commented
Jun 24, 2021
| val roleExpiry: LocalDateTime? = null | ||
| val roleExpiry: LocalDateTime? = null, | ||
| val bangStreak: Int = 0//, | ||
| // val bangAttempts: Int = 0, |
Author
There was a problem hiding this comment.
i can remove these lines or adjust this code when we come to decision
andrewlinington
commented
Jun 24, 2021
andrewlinington
commented
Jun 24, 2021
| checkPanic() | ||
| if (!panic) { | ||
| printBangResult(bangEntity, chambers) | ||
| performBangForResult(bangEntity) |
Author
There was a problem hiding this comment.
added this code to perform all the repository actions
andrewlinington
commented
Jun 24, 2021
| private fun finishTimer () { | ||
| timer?.cancel() | ||
| timer = null | ||
| manageQueue() |
Author
There was a problem hiding this comment.
adjusted to manage the queue in one function
andrewlinington
commented
Jun 24, 2021
| queue.forEach { updates.getOrPut(it.userId!!) { LinkedList() }.add(it) } | ||
|
|
||
| printResults(updates) | ||
| performResultUpdates(updates) |
Author
There was a problem hiding this comment.
does the action after printing as to ensure it is printed based on the actions then updates them
andrewlinington
commented
Jun 24, 2021
| todayBangerRepository.deleteAll() | ||
| } | ||
|
|
||
| private fun performBangForResult (bangEntity: BangEntity) { |
andrewlinington
commented
Jun 24, 2021
| userRepository.addMoney(bangEntity.userId, money) | ||
| } | ||
|
|
||
| private fun performDailyUpdate(userId: Long): Long { |
andrewlinington
commented
Jun 24, 2021
| return 0L | ||
| } | ||
|
|
||
| private fun performResultUpdates(updates: HashMap<Long, LinkedList<BangEntity>>) { |
andrewlinington
commented
Jun 24, 2021
| } | ||
| } | ||
|
|
||
| private fun performIndividualResultUpdate(userUpdates: LinkedList<BangEntity>, userId: Long) { |
andrewlinington
commented
Jun 24, 2021
| else "" | ||
| } | ||
|
|
||
| private fun getDailyResultOutputString (name: String, userId: Long): String { |
andrewlinington
commented
Jun 24, 2021
| "\n$name received their daily reward of 5 GryphCoins!\n" + getBonusForStreakString(userId) else "\n" | ||
| } | ||
|
|
||
| private fun getBonusForStreakString (userId: Long): String { |
andrewlinington
commented
Jun 24, 2021
| Deaths: ${userUpdates.count { it.result == BangResult.DIE.value }} | ||
| Jams: ${userUpdates.count { it.result == BangResult.JAM.value }} | ||
| """.trimIndent() | ||
| output += getDailyResultOutputString(user.safeName(), user.idLong) |
Author
There was a problem hiding this comment.
adjusted so daily prints with each user instead of at the bottom
…ring profile information
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements bang and a rudimentary profile for the user to be able to use.