This commit is contained in:
Alex committed 2025-01-14 14:20:01 +03:00
1 parent 574875892d
commit 5e831cc6ac
2 files changed
+8 -19

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@ class VoteCreate(APIView):
def post(self, request):
try:
vote = self.create_vote(request)
self.create_news(request)
# self.create_news(request)
return Response({'status': 'success', 'message': 'Vote and news created successfully.'}, status=200)
except Exception as e:
return Response({'status': 'error', 'message': str(e)}, status=400)
+7 -18
View File
@@ -17,7 +17,7 @@
<v-tabs-window-item value="current">
<v-container>
<v-row>
<v-col v-for="voting in sortedCurrentVotes" :key="voting.id" cols="12" lg="3" md="4">
<v-col v-for="voting in votes" :key="voting.id" cols="12" lg="3" md="4">
<VoteCardVue :voteCard="voting" @openVoteModal="openVoteModal" @openEditVoteModal="openEditVoteModal"
@deleteVoting="deleteVoting" />
</v-col>
@@ -29,7 +29,7 @@
<v-tabs-window-item value="completed">
<v-container>
<v-row>
<v-col v-for="voting in sortedCompletedVotes" :key="voting.id" cols="12" lg="3" md="4">
<v-col v-for="voting in votes" :key="voting.id" cols="12" lg="3" md="4">
<v-card>
<v-card-title>{{ voting.title }}</v-card-title>
<v-card-subtitle>
@@ -102,7 +102,7 @@
</template>
<script>
import { computed, ref } from "vue";
import { ref } from "vue";
import VoteConstructor from "@/components/vote/VoteConstructor.vue";
import CurrentVote from "@/components/vote/CurrentVote.vue";
import VoteCardVue from "@/components/vote/VoteCard.vue";
@@ -118,7 +118,8 @@ export default {
function updating(param) {
getVotes(param)
.then(data => {
votes.value = data.votes;
console.log(data);
votes.value = data;
})
}
@@ -129,17 +130,6 @@ export default {
const resultsModal = ref(false);
const selectedVoting = ref(null);
const sortedCurrentVotes = computed(() => {
return votes.value
.filter((v) => new Date(v.dateend) > new Date())
.sort((a, b) => new Date(a.dateend) - new Date(b.dateend));
});
const sortedCompletedVotes = computed(() => {
return votes.value
.filter((v) => new Date(v.dateend) <= new Date())
.sort((a, b) => new Date(b.dateend) - new Date(a.dateend));
});
const timeRemaining = (dateend) => {
const now = new Date();
@@ -191,8 +181,6 @@ export default {
return {
currentTab,
votes,
sortedCurrentVotes,
sortedCompletedVotes,
voteModal,
resultsModal,
selectedVoting,
@@ -207,7 +195,8 @@ export default {
editVoteModal,
openEditVoteModal,
closeEditVoteModal,
updating
updating,
votingData
};
},
};