Эх сурвалжийг харах

fix to send votes

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 жил өмнө
parent
commit
d31a9b1ade

+ 2 - 1
app/src/main/java/com/nextcloud/talk/api/NcApi.java

@@ -536,10 +536,11 @@ public interface NcApi {
     Observable<PollOverall> createPoll(@Header("Authorization") String authorization,
     Observable<PollOverall> createPoll(@Header("Authorization") String authorization,
                                        @Url String url);
                                        @Url String url);
 
 
+    @FormUrlEncoded
     @POST
     @POST
     Observable<PollOverall> votePoll(@Header("Authorization") String authorization,
     Observable<PollOverall> votePoll(@Header("Authorization") String authorization,
                                      @Url String url,
                                      @Url String url,
-                                     @Query("optionIds[]") List<Integer> optionIds);
+                                     @Field("optionIds[]") List<Integer> optionIds);
 
 
     @DELETE
     @DELETE
     Observable<PollOverall> closePoll(@Header("Authorization") String authorization,
     Observable<PollOverall> closePoll(@Header("Authorization") String authorization,

+ 1 - 1
app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt

@@ -115,7 +115,7 @@ class PollResultsFragment(
             val oneVoteInPercent = 100 / votersAmount
             val oneVoteInPercent = 100 / votersAmount
 
 
             poll.options?.forEachIndexed { index, option ->
             poll.options?.forEachIndexed { index, option ->
-                val votersForThisOption = poll.votes?.filter { it.value == index }?.size!!
+                val votersForThisOption = poll.votes?.filter { it.key.toInt() == index }?.size!!
                 val optionsPercent = oneVoteInPercent * votersForThisOption
                 val optionsPercent = oneVoteInPercent * votersForThisOption
 
 
                 val pollResultItem = PollResultItem(option, optionsPercent)
                 val pollResultItem = PollResultItem(option, optionsPercent)

+ 1 - 1
app/src/main/res/layout/dialog_poll_vote.xml

@@ -30,7 +30,7 @@
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         tools:layout_height="400dp"
         tools:layout_height="400dp"
-        tools:layout_width="match_parent"></RadioGroup>
+        tools:layout_width="match_parent" />
 
 
     <com.google.android.material.button.MaterialButton
     <com.google.android.material.button.MaterialButton
         android:id="@+id/submitVote"
         android:id="@+id/submitVote"