diff --git a/src/api/voting.js b/src/api/voting.js index 5b07932..b2b0cfd 100644 --- a/src/api/voting.js +++ b/src/api/voting.js @@ -1,8 +1,10 @@ import routes from "./routes"; import request from "./request"; -async function getBallot() { - return request(routes.voting_ballot); +async function getBallot(page, per) { + return request(routes.voting_ballot, { + params: { page, per } + }); } async function cast(answerId, email) { diff --git a/src/views/Accounts/Register/index.vue b/src/views/Accounts/Register/index.vue index 6d5b442..3c868d7 100644 --- a/src/views/Accounts/Register/index.vue +++ b/src/views/Accounts/Register/index.vue @@ -74,6 +74,10 @@ import Step4 from "./Step4"; import * as api from "@/api"; +function validateEmail(mail) { + return /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(mail); +} + export default { components: { Step1, @@ -102,7 +106,7 @@ export default { await api.auth.createAccount({ foundUs: this.fields.heardAboutUs.value === "Other" - ? this.fields.heardAboutUsText.value + ? "Other - " + this.fields.heardAboutUsText.value : this.fields.heardAboutUs.value, studentFirstName: this.fields.firstName.value, studentLastName: this.fields.lastName.value, @@ -153,7 +157,7 @@ export default { label: "Parent's E-mail Address", type: "email", value: "", - rules: [v => !!v || "Please provide a email"] + rules: [v => validateEmail(v) || "Please provide a valid e-mail"] }, studentEmail: { label: "Student's E-mail Address (optional)", diff --git a/src/views/Quiz/QuizCountdown.vue b/src/views/Quiz/QuizCountdown.vue index a929a12..fe9f063 100644 --- a/src/views/Quiz/QuizCountdown.vue +++ b/src/views/Quiz/QuizCountdown.vue @@ -7,7 +7,7 @@
Congratulations, {{ User.displayName }}!
- You've conquered Level {{ User.rank }}. + You've conquered Level {{ User.rank - 1 }}.

That's all the questions available for now.
@@ -16,7 +16,7 @@
Congratulations, {{ User.displayName }}!
- You've conquered Level {{ User.rank }}. + You've conquered Level {{ User.rank - 1 }}.

@@ -37,7 +37,15 @@ icon >mdi-facebook - mdi-twitter + mdi-twitter diff --git a/src/views/Quiz/QuizFinalQuestion.vue b/src/views/Quiz/QuizFinalQuestion.vue index 0c84ce1..ba0f511 100644 --- a/src/views/Quiz/QuizFinalQuestion.vue +++ b/src/views/Quiz/QuizFinalQuestion.vue @@ -90,11 +90,12 @@ export default { const jsCode = `function calculateAnswer(){ return 100; } +// we check your answer by looking at the output var var output = calculateAnswer();`; const pyCode = `def calculateAnswer(): return 100 - -output = calculateAnswer()`; +# we check your answer by what you print +print(calculateAnswer())`; return { isLoading: false, isSubmitting: false, diff --git a/src/views/Voting/Ballot.vue b/src/views/Voting/Ballot.vue index f016711..4b69f6a 100644 --- a/src/views/Voting/Ballot.vue +++ b/src/views/Voting/Ballot.vue @@ -3,21 +3,34 @@

- Lorem Ipsum is simply dummy text of the printing and typesetting - industry. Lorem Ipsum has been the industry's standard dummy text ever - since the 1500s, when an unknown printer took a galley of type and - scrambled it to make a type specimen book. + Cast your vote below!

- + + + +

+ Loading Results
Please Wait
+

+
+
+ - + /> + + + @@ -36,12 +49,14 @@ export default { }, data() { return { + isLoading: true, + per: 16, item: null, showModal: false, hasNext: false, hasPrev: false, nextNum: false, - page: 0, + page: 1, prevNum: null, totalItems: 0, totalPages: 0, @@ -53,30 +68,28 @@ export default { showCode(item) { this.item = item; this.showModal = true; + }, + async loadPage() { + this.isLoading = true; + try { + const results = await voting.getBallot(this.page, this.per); + for (const [key, value] of Object.entries(results)) { + Vue.set(this, key, value); + } + // console.log(results); + } catch (err) { + this.$router.push({ name: "redirect" }); + } + this.isLoading = false; } }, - async mounted() { - // for (let i = 0; i < 100; i++) { - // this.items.push({ - // display: "Kyle A.", - // firstName: "Kyle", - // id: 45, - // lastName: "Askew", - // numVotes: 0, - // text: - // "function calculateAnswer(){\n return 100;\n}\nvar output = calculateAnswer();;output", - // username: "net8floz2" - // }); - // } - try { - const results = await voting.getBallot(); - for (const [key, value] of Object.entries(results)) { - Vue.set(this, key, value); - } - // console.log(results); - } catch (err) { - this.$router.push({ name: "redirect" }); + watch: { + page(val) { + this.loadPage(val); } + }, + async mounted() { + this.loadPage(); } }; diff --git a/src/views/Voting/CodeModal.vue b/src/views/Voting/CodeModal.vue index 70b3092..c074c0b 100644 --- a/src/views/Voting/CodeModal.vue +++ b/src/views/Voting/CodeModal.vue @@ -51,22 +51,9 @@
- - - - We have sent a voting confirmation e-mail. - - - Please check your inbox to confirm your vote. - - - - Okay - - - + + + @@ -77,7 +64,7 @@ - Okay @@ -88,8 +75,12 @@ + +