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/poll #195

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Feat/poll #195

wants to merge 13 commits into from

Conversation

MiniAppleTheApple
Copy link
Collaborator

Why need this change? / Root cause:

  • Implement poll command

Changes made:

  • Add poll into dependecies
  • Fix typo
  • Add vote limit
  • Add "vote-limit" optional option

Test Scope / Change impact:

@MiniAppleTheApple MiniAppleTheApple linked an issue Sep 3, 2023 that may be closed by this pull request
@sonarcloud
Copy link

sonarcloud bot commented Sep 3, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Collaborator

@Wally5077 Wally5077 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review done.

add(it)
val emojiIndex = EMOJI_UNICODES.indexOf(vote.emoji.name)
if (emojiIndex >= 0) {
val optionIndex = voterIdToVotedOptionIndex[vote.userId]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這也要是複數

@@ -33,6 +34,8 @@ private const val OPTION_QUESTION = "question"

private const val OPTION_OPTIONS = "options"

private const val OPTION_VOTE_LIMIT = "vote-limit"

private val EMOJI_UNICODES: Array<String> = arrayOf("0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "\uD83D\uDD1F")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改用 enum class

.addRequiredOption(OptionType.INTEGER, OPTION_TIME, "The duration of the poll session")
.addRequiredOption(OptionType.STRING, OPTION_TIMEUNIT, "(Day | Minute | Second)")
.addRequiredOption(OptionType.STRING, OPTION_TIMEUNIT, "(Days | Minutes | Seconds)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用 addChoice(),新增 Days、Minutes、Seconds 三個參數。

@@ -158,41 +171,58 @@ data class PollingSetting(val time: Long, val timeUnit: TimeUnit, val question:
}

data class Vote(val userId: String, val emoji: EmojiUnion)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emoji 改成用 Int,存數字

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.

[任務] 投票指令 /poll
3 participants