From 5d87c25afa3958963918249cdd909f473b888d5f Mon Sep 17 00:00:00 2001 From: Miguel Angel G Date: Sun, 30 Aug 2020 20:07:40 -0500 Subject: [PATCH] Allow multiple submissions --- app/assets/v2/js/pages/dashboard-sponsors.js | 17 +---------------- app/assets/v2/js/vue-components.js | 18 ------------------ 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/app/assets/v2/js/pages/dashboard-sponsors.js b/app/assets/v2/js/pages/dashboard-sponsors.js index a0029ad2bf2..56dffb0011a 100644 --- a/app/assets/v2/js/pages/dashboard-sponsors.js +++ b/app/assets/v2/js/pages/dashboard-sponsors.js @@ -13,7 +13,7 @@ window.open(url, 'Loading', 'top=0,left=0,width=400,height=600,status=no,toolbar=no,location=no,menubar=no,titlebar=no'); }, - markWinner: function($event, project, prizeIndex) { + markWinner: function($event, project) { let vm = this; const url = '/api/v0.1/hackathon_project/set_winner/'; const markWinner = fetchData(url, 'POST', { @@ -21,21 +21,6 @@ winner: $event ? 1 : 0 }, {'X-CSRFToken': vm.csrf}); - vm.prizes[prizeIndex].submissions.forEach((submission, submissionIndex) => { - if (submission.pk !== project.pk && submission.winner) { - console.log(submission.pk); - console.log(project.pk); - const unmarkPreviousWinner = fetchData(url, 'POST', { - project_id: submission.pk, - winner: 0 - }, {'X-CSRFToken': vm.csrf}); - - $.when(unmarkPreviousWinner).then(() => { - vm.$set(vm.prizes[prizeIndex].submissions[submissionIndex], 'winner', false); - }); - } - }); - $.when(markWinner).then(response => { if (response.message) { alert(response.message); diff --git a/app/assets/v2/js/vue-components.js b/app/assets/v2/js/vue-components.js index 5f2a01be771..415edbca67f 100644 --- a/app/assets/v2/js/vue-components.js +++ b/app/assets/v2/js/vue-components.js @@ -524,23 +524,6 @@ Vue.component('project-card', { } }, methods: { - markWinner: function($event, project) { - let vm = this; - - const url = '/api/v0.1/hackathon_project/set_winner/'; - const markWinner = fetchData(url, 'POST', { - project_id: project.pk, - winner: $event ? 1 : 0 - }, {'X-CSRFToken': vm.csrf}); - - $.when(markWinner).then(response => { - if (response.message) { - alert(response.message); - } - }).catch(err => { - console.log(err); - }); - }, projectModal() { let project = this.$props.project; @@ -549,7 +532,6 @@ Vue.component('project-card', { }, template: `
- mark winner badge