-
Notifications
You must be signed in to change notification settings - Fork 1
Bang Implementation #3
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
base: master
Are you sure you want to change the base?
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.
| val roleExpiry: LocalDateTime? = null | ||
| val roleExpiry: LocalDateTime? = null, | ||
| val bangStreak: Int = 0//, | ||
| // val bangAttempts: Int = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can remove these lines or adjust this code when we come to decision
| checkPanic() | ||
| if (!panic) { | ||
| printBangResult(bangEntity, chambers) | ||
| performBangForResult(bangEntity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added this code to perform all the repository actions
| private fun finishTimer () { | ||
| timer?.cancel() | ||
| timer = null | ||
| manageQueue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted to manage the queue in one function
| queue.forEach { updates.getOrPut(it.userId!!) { LinkedList() }.add(it) } | ||
|
|
||
| printResults(updates) | ||
| performResultUpdates(updates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the action after printing as to ensure it is printed based on the actions then updates them
| todayBangerRepository.deleteAll() | ||
| } | ||
|
|
||
| private fun performBangForResult (bangEntity: BangEntity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new addtion
| userRepository.addMoney(bangEntity.userId, money) | ||
| } | ||
|
|
||
| private fun performDailyUpdate(userId: Long): Long { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new addition
| return 0L | ||
| } | ||
|
|
||
| private fun performResultUpdates(updates: HashMap<Long, LinkedList<BangEntity>>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new addition
| } | ||
| } | ||
|
|
||
| private fun performIndividualResultUpdate(userUpdates: LinkedList<BangEntity>, userId: Long) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new addition
| else "" | ||
| } | ||
|
|
||
| private fun getDailyResultOutputString (name: String, userId: Long): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new addition
| "\n$name received their daily reward of 5 GryphCoins!\n" + getBonusForStreakString(userId) else "\n" | ||
| } | ||
|
|
||
| private fun getBonusForStreakString (userId: Long): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new addition
| Deaths: ${userUpdates.count { it.result == BangResult.DIE.value }} | ||
| Jams: ${userUpdates.count { it.result == BangResult.JAM.value }} | ||
| """.trimIndent() | ||
| output += getDailyResultOutputString(user.safeName(), user.idLong) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted so daily prints with each user instead of at the bottom
…ring profile information
Implements bang and a rudimentary profile for the user to be able to use.