From ed3d7d72018ae5397028646761675bf5a624e539 Mon Sep 17 00:00:00 2001 From: reeshi-18 Date: Wed, 7 Dec 2022 01:41:20 +0530 Subject: [PATCH 01/25] added dark theme variable --- src/App.vue | 2 +- src/styles/modules/_navbar.scss | 2 +- src/styles/partials/_variables.scss | 49 ++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index e6aad19..ffd1080 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,7 +38,7 @@ export default { z-index: 1; min-height: 100%; display: flex; - background-color: #fcfcfc; + background-color: $theme-color-white; } @media only screen and (max-width: 1280) { diff --git a/src/styles/modules/_navbar.scss b/src/styles/modules/_navbar.scss index b083cf8..04ea3c2 100644 --- a/src/styles/modules/_navbar.scss +++ b/src/styles/modules/_navbar.scss @@ -1,5 +1,5 @@ .navbar { - background-color: #fcfcfc; + background-color: $theme-color-white; width: 100%; height: 2rem; display: flex; diff --git a/src/styles/partials/_variables.scss b/src/styles/partials/_variables.scss index 5ed1fb6..5926883 100644 --- a/src/styles/partials/_variables.scss +++ b/src/styles/partials/_variables.scss @@ -1,3 +1,5 @@ +$dark-theme: true; + $root-font-size: 0.8982vw; // $root-font-size-small: ; // $root-font-size-large: ; @@ -7,8 +9,9 @@ $root-base-size: 16; $primary-font-family: "Nunito Sans", sans-serif; $secondary-font-family: "Open Sans", sans-serif; + // colors variables -$theme-color-white: #ffffff; +$theme-color-white: #fcfcfc; $theme-color-offwhite: #f2f2f2; $theme-color-dark-white: #e7e7e7; $theme-color-black: #000000; @@ -47,6 +50,50 @@ $theme-color-violet-med-transp: rgba(89, 60, 143, 0.57); $theme-color-dark-black-low-transp: rgba(0, 0, 0, 0.15); $theme-color-dark-blue-high-transp: rgba(76, 128, 165, 0.75); + +@if $dark-theme { + $theme-color-white: #000000; + $theme-color-offwhite: #120f0f; + $theme-color-dark-white: #0c0b0e; + $theme-color-black: #fcfcfe; + $theme-color-black19: #d7d6d7; + $theme-color-blue: #355dc5; + $theme-color-orange: #ff9458; + $theme-color-dark-orange: #e44f26; + $theme-color-light-orange: #cc652b; + $theme-color-grey57: #575757; + $theme-color-grey39: #393939; + $theme-color-grey: #555555; + $theme-color-dark-grey: #444444; + $theme-color-light-grey: #999999; + $theme-color-off-white: #dddddd; + $theme-color-light-grey-d7: #d7d7d7; + $theme-color-white-grey: #b3b3b3; + $theme-color-dark-blue: #2e9cca; + $theme-color-light-blue: #808cad; + $theme-color-red: #aa3126; + $theme-color-violet: #411396; + $theme-color-white-low-transp: rgba(0,0,0,0.05); + $theme-color-black-low-transp: rgba(41, 40, 40, 0.5); + $theme-color-black-med-transp: rgba(57, 57, 57, 0.57); + $theme-color-black-high-transp: rgba(44, 43, 42, 0.8); + $theme-color-green-high-transp: rgba(7, 60, 23, 1); + $theme-color-yellow-high-transp: rgba(88, 75, 6, 1); + $theme-color-red-high-transp: rgba(87, 18, 17, 1); + $theme-color-dark-red-med-transp: rgba(255, 103, 0, 0.3); + $theme-color-grey-low-transp: rgba(87, 87, 87, 0.07); + $theme-color-grey-med-transp: rgba(87, 87, 87, 0.2); + $theme-color-grey-high-transp: rgba(87, 87, 87, 0.35); + $theme-color-blue-low-transp: rgba(37, 85, 124, 0.2); + $theme-color-light-black-low-transp: rgba(221, 221, 221, 0.1); + $theme-color-light-black-med-transp: rgba(138, 138, 138, 0.57); + $theme-color-violet-med-transp: rgba(89, 60, 143, 0.57); + $theme-color-dark-black-low-transp: rgba(255, 255, 255, 0.15); + $theme-color-dark-blue-high-transp: rgba(76, 128, 165, 0.35); +} + + + $primary-font-color: $theme-color-black; $primary-theme-color: $theme-color-blue; $secondary-theme-color: $theme-color-orange; From 562e4b512a5beeab6d711606946711f0aa093095 Mon Sep 17 00:00:00 2001 From: reeshi-18 Date: Wed, 7 Dec 2022 18:32:19 +0530 Subject: [PATCH 02/25] iteration2 changes --- src/App.vue | 2 +- src/styles/modules/_footer.scss | 2 +- src/styles/modules/_previewModal.scss | 4 +++- src/styles/partials/_variables.scss | 9 +++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index ffd1080..98c7dd8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -32,7 +32,7 @@ export default { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; - color: #2c3e50; + color: $theme-color-grey-blue; font-size: 1vw; overflow: hidden; z-index: 1; diff --git a/src/styles/modules/_footer.scss b/src/styles/modules/_footer.scss index 0017975..3a4040b 100644 --- a/src/styles/modules/_footer.scss +++ b/src/styles/modules/_footer.scss @@ -17,7 +17,7 @@ } .adminFooterTitle { - color: #191919 !important; + color: $theme-color-black19 !important; text-align: left; vertical-align: middle; font-family: $primary-font-family; diff --git a/src/styles/modules/_previewModal.scss b/src/styles/modules/_previewModal.scss index 35da568..88cde51 100644 --- a/src/styles/modules/_previewModal.scss +++ b/src/styles/modules/_previewModal.scss @@ -45,15 +45,17 @@ font-family: $primary-font-family; font-size: 1.5rem; border-bottom: 0.0625rem solid rgba(87, 87, 87, 0.7); + background-color: $theme-color-white; } .modal-close-button { outline: none; border: none; - background-color: white; + background-color: $theme-color-white; } .modal-body { padding: 4rem calc(10rem * 1440 / 1980); + background-color: $theme-color-white; } \ No newline at end of file diff --git a/src/styles/partials/_variables.scss b/src/styles/partials/_variables.scss index 5926883..614b99d 100644 --- a/src/styles/partials/_variables.scss +++ b/src/styles/partials/_variables.scss @@ -28,6 +28,7 @@ $theme-color-light-grey: #999999; $theme-color-off-white: #dddddd; $theme-color-light-grey-d7: #d7d7d7; $theme-color-white-grey: #b3b3b3; +$theme-color-grey-blue: #2c3e50; $theme-color-dark-blue: #355dc5; $theme-color-light-blue: #d6def3; $theme-color-red: #b83428; @@ -61,14 +62,14 @@ $theme-color-dark-blue-high-transp: rgba(76, 128, 165, 0.75); $theme-color-orange: #ff9458; $theme-color-dark-orange: #e44f26; $theme-color-light-orange: #cc652b; - $theme-color-grey57: #575757; - $theme-color-grey39: #393939; + $theme-color-grey57: #747474; + $theme-color-grey39: #a5a5a5; $theme-color-grey: #555555; $theme-color-dark-grey: #444444; $theme-color-light-grey: #999999; $theme-color-off-white: #dddddd; - $theme-color-light-grey-d7: #d7d7d7; - $theme-color-white-grey: #b3b3b3; + $theme-color-light-grey-d7: #3d3d3d; + $theme-color-white-grey: #909090; $theme-color-dark-blue: #2e9cca; $theme-color-light-blue: #808cad; $theme-color-red: #aa3126; From 37181a4cddc4938dc8bc447c0f00324ca5c692e5 Mon Sep 17 00:00:00 2001 From: reeshi-18 Date: Thu, 8 Dec 2022 01:23:09 +0530 Subject: [PATCH 03/25] iteration3 changes made --- src/assets/labs-logo-dark.svg | 4 ++++ src/assets/main-logo-dark.svg | 3 +++ src/assets/sdslabs-logo-dark.svg | 4 ++++ src/assets/sdslabs-logo-dark.svg:Zone.Identifier | 3 +++ src/components/Footer.vue | 10 +++++++++- src/components/Navbar.vue | 5 ++--- src/constants/images.js | 3 +++ src/layouts/Auth.vue | 12 +++++------- src/styles/modules/_adminNotifications.scss | 3 ++- src/styles/modules/_statsNavbar.scss | 2 +- src/styles/partials/_variables.scss | 16 ++++++++++------ 11 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 src/assets/labs-logo-dark.svg create mode 100644 src/assets/main-logo-dark.svg create mode 100644 src/assets/sdslabs-logo-dark.svg create mode 100644 src/assets/sdslabs-logo-dark.svg:Zone.Identifier diff --git a/src/assets/labs-logo-dark.svg b/src/assets/labs-logo-dark.svg new file mode 100644 index 0000000..d0e9cc7 --- /dev/null +++ b/src/assets/labs-logo-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/main-logo-dark.svg b/src/assets/main-logo-dark.svg new file mode 100644 index 0000000..461b3d7 --- /dev/null +++ b/src/assets/main-logo-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/sdslabs-logo-dark.svg b/src/assets/sdslabs-logo-dark.svg new file mode 100644 index 0000000..bc98fb6 --- /dev/null +++ b/src/assets/sdslabs-logo-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/sdslabs-logo-dark.svg:Zone.Identifier b/src/assets/sdslabs-logo-dark.svg:Zone.Identifier new file mode 100644 index 0000000..a857cc9 --- /dev/null +++ b/src/assets/sdslabs-logo-dark.svg:Zone.Identifier @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +HostUrl=https://files.slack.com/files-pri/T025QJXB7-F04E1278NNA/download/labs.svg?origin_team=T025QJXB7 diff --git a/src/components/Footer.vue b/src/components/Footer.vue index 9856d18..11bf695 100644 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -10,7 +10,10 @@
- + + + +
@@ -23,15 +26,20 @@ From 773ea66f32744e86917f9ab35bff6804b58bcdbf Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Wed, 5 Feb 2025 18:54:14 +0530 Subject: [PATCH 07/25] fix: change register flow , and add email check Signed-off-by: Arshdeep54 --- src/styles/modules/_auth.scss | 198 ++++++++++++++++++++--- src/views/Login.vue | 6 +- src/views/Register.vue | 286 +++++++++++++++++++++++++--------- 3 files changed, 393 insertions(+), 97 deletions(-) diff --git a/src/styles/modules/_auth.scss b/src/styles/modules/_auth.scss index 9d557a1..831ff21 100644 --- a/src/styles/modules/_auth.scss +++ b/src/styles/modules/_auth.scss @@ -52,43 +52,144 @@ .info { position: relative; - margin-bottom: 1rem; + margin-bottom: 1.25rem; + + .step-title { + font-size: 1.1rem; + font-weight: 500; + color: $theme-color-grey39; + margin-bottom: 0.5rem; + } .inputField { width: 100%; + max-width: 320px; + height: 12px; + margin-top: 0.5rem; + padding: 0.75rem 1rem; + border: 1px solid $theme-color-light-grey-d7; + border-radius: 4px; + font-size: 0.95rem; + transition: all 0.2s ease; + background-color: #fff; + + &:focus { + outline: none; + border-color: $theme-color-light-orange; + box-shadow: 0 0 0 2px rgba($theme-color-light-orange, 0.1); + } + + &::placeholder { + color: $theme-color-grey57; + font-size: 0.95rem; + } + } + + .verification-message { + font-size: 0.85rem; + color: $theme-color-grey57; + margin-top: 0.5rem; + margin-bottom: 0.5rem; + display: flex; + align-items: center; + gap: 0.5rem; + + &::before { + content: "ⓘ"; + color: $theme-color-light-orange; + } + } + + .timer-container { margin-top: 1rem; - padding: 0.75rem; + text-align: center; + font-size: 0.9rem; + color: $theme-color-grey39; + + .resend-button { + background: none; + border: none; + color: $theme-color-light-orange; + cursor: pointer; + font-size: 0.9rem; + padding: 0; + text-decoration: underline; + + &:hover { + color: darken($theme-color-light-orange, 10%); + } + } + } + } + + .email-input-container, + .otp-input-container { + position: relative; + display: flex; + align-items: center; + gap: 1rem; + margin-top: 0.5rem; + max-width: 330px; + + .inputField { + flex: 1; + height: 12px; + margin-top: 0; + padding: 0.75rem 1rem; border: 1px solid $theme-color-light-grey-d7; border-radius: 4px; - font-size: 1rem; + font-size: 0.95rem; + transition: all 0.2s ease; &:focus { outline: none; border-color: $theme-color-light-orange; + box-shadow: 0 0 0 2px rgba($theme-color-light-orange, 0.1); + } + + &:read-only { + background-color: $theme-color-light-grey-d7; + cursor: not-allowed; } } - .verify-button { - position: absolute; - right: 8px; - top: 50%; - transform: translateY(-50%); + .otp-button { + min-width: 110px; + height: 42px; background: $theme-color-light-orange; color: $theme-color-white; border: none; - padding: 0.5rem 1rem; border-radius: 4px; + font-size: 0.95rem; + font-weight: 500; cursor: pointer; + transition: all 0.3s ease; + + &:hover:not(:disabled) { + background: darken($theme-color-light-orange, 5%); + transform: translateY(-1px); + } &:disabled { background: $theme-color-light-grey-d7; cursor: not-allowed; } - } - .verification-message { - margin-bottom: 1rem; - color: $theme-color-grey39; + &.verify { + background: $theme-color-white; + border: 1px solid $theme-color-light-orange; + color: $theme-color-light-orange; + + &:hover:not(:disabled) { + background: rgba($theme-color-light-orange, 0.1); + } + + &:disabled { + border-color: $theme-color-light-grey-d7; + color: $theme-color-light-grey-d7; + background: $theme-color-white; + } + } } } @@ -109,21 +210,78 @@ .form-actions { margin-top: 2rem; + max-width: 320px; - .next-arrow { - display: flex; + .next-button { + display: inline-flex; align-items: center; - gap: 0.5rem; + padding: 0.3rem 1rem; + background: $theme-color-white; + border: 1px solid $theme-color-light-orange; + border-radius: 4px; cursor: pointer; - color: $theme-color-light-orange; + transition: all 0.3s ease; + + .next-text { + margin-right: 0.75rem; + color: $theme-color-light-orange; + font-weight: 500; + font-size: 0.95rem; + } + + svg { + color: $theme-color-light-orange; + transition: transform 0.3s ease; + } + + &:hover { + box-shadow: 0 4px 12px rgba($theme-color-light-orange, 0.2); + transform: translateY(-2px); + + svg { + transform: translateX(4px); + } + } &.disabled { - color: $theme-color-light-grey-d7; + opacity: 0.6; cursor: not-allowed; + &:hover { + box-shadow: none; + transform: none; + svg { + transform: none; + } + } } + } + } - .next-text { - font-weight: 500; + .register-button-container { + margin-top: 2rem; + width: 100%; + max-width: 320px; + + .register-button { + width: 100%; + height: 42px; + font-size: 0.95rem; + font-weight: 500; + background: #f2f2f2; + color: $theme-color-grey39; + border: none; + border-radius: 4px; + cursor: pointer; + transition: all 0.3s ease; + + &:hover:not(:disabled) { + background: darken(#f2f2f2, 5%); + } + + &:disabled { + background: #f2f2f2; + color: $theme-color-grey57; + cursor: not-allowed; } } } diff --git a/src/views/Login.vue b/src/views/Login.vue index 9329883..ca05875 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -36,8 +36,10 @@ text="Login" />
- -
+
+ +
+ diff --git a/src/views/Register.vue b/src/views/Register.vue index 11d1e72..39c3ee8 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -2,7 +2,7 @@
- Register for n00b + Register for play
@@ -10,82 +10,190 @@
- -
-
- -
- -
{{ UsernameErr }}
-
-
-
-
- Next - - - -
-
-
- -
-
Setup Email
- - +
{{ EmailErr }}
+
Please enter the OTP sent to {{ email }}
- - +
+ + +
{{ OtpErr }}
Resend OTP in {{ timer }} seconds - + +
+
+ +
+
+ Next + + + +
+
+
+ +
+
Basic Info
+
+ +
+
+ +
+ +
{{ UsernameErr }}
+
+
+
+
+ Next + + +
- +
{{ PassLen }}
- +
{{ PassErr }}
-
-
+
1
-
Basic Info
+
Setup Email
-
+
2
-
Setup Email
+
Basic Info
@@ -94,7 +202,6 @@
-
@@ -104,46 +211,46 @@ From 60d945c0a461c5957ae9537edc7e735622610232 Mon Sep 17 00:00:00 2001 From: SomyaChawla0250 Date: Wed, 5 Feb 2025 20:21:32 +0530 Subject: [PATCH 08/25] integrated OTP --- src/api/admin/otpAPI.js | 31 +++++++++++++++++++++++++++++++ src/views/Register.vue | 28 +++++++++++++++++++--------- 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 src/api/admin/otpAPI.js diff --git a/src/api/admin/otpAPI.js b/src/api/admin/otpAPI.js new file mode 100644 index 0000000..d3170ca --- /dev/null +++ b/src/api/admin/otpAPI.js @@ -0,0 +1,31 @@ +import axiosInstance from "../axiosInstance.js"; + +export default { + async sendOTP(email) { + let bodyFormData = new FormData(); + bodyFormData.append("email", email); + + const response = await axiosInstance({ + method: "post", + url: `/auth/send-otp`, + data: bodyFormData + }); + + return response; +}, + +async verifyOTP(email,otp) { + let bodyFormData = new FormData(); + bodyFormData.append("email", email); + bodyFormData.append("otp", otp); + + const response = await axiosInstance({ + method: "post", + url: `/auth/verify-otp`, + data: bodyFormData + }); + + return response; +} + +}; diff --git a/src/views/Register.vue b/src/views/Register.vue index 39c3ee8..fc70974 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -212,6 +212,7 @@ + + From dd415b06855e69c9aab8aefd7dbb8e963f953bb2 Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 6 Feb 2025 12:35:31 +0530 Subject: [PATCH 10/25] refactor: change leaderboard logo Signed-off-by: Arshdeep54 --- src/assets/leaderboard.svg | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/assets/leaderboard.svg b/src/assets/leaderboard.svg index 4f23cb4..8ed83e0 100644 --- a/src/assets/leaderboard.svg +++ b/src/assets/leaderboard.svg @@ -1,4 +1,11 @@ - - + + + + + + + + + From ab4c3fb0fe9aeebf69efa91bafba19bee0c25284 Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 13 Feb 2025 00:00:52 +0530 Subject: [PATCH 11/25] add pagination in leaderboard Signed-off-by: Arshdeep54 --- src/api/admin/submissionsAPI.js | 13 ++- src/api/admin/usersAPI.js | 10 ++ src/components/ChallCard.vue | 4 + src/components/LeaderboardGraph.vue | 87 +++++++++++----- src/components/LineGraph.vue | 22 ++-- src/components/adminTable.vue | 152 ++++++++++++++++++---------- src/constants/constants.js | 2 +- src/styles/modules/_adminTable.scss | 10 +- src/views/Leaderboard.vue | 91 ++++++++++------- 9 files changed, 261 insertions(+), 130 deletions(-) diff --git a/src/api/admin/submissionsAPI.js b/src/api/admin/submissionsAPI.js index 38e0721..5accb19 100644 --- a/src/api/admin/submissionsAPI.js +++ b/src/api/admin/submissionsAPI.js @@ -13,12 +13,15 @@ export default { }); return submissions; }, - async getUserSubs(username) { - const response = await this.getSubmissions(); - let data = response.filter(el => { - return el.username === username; + + // Group submissions by username for efficient processing + groupSubmissionsByUsers(submissions, usernames) { + console.log("Called",submissions); + const userSubmissions = {}; + usernames.forEach(username => { + userSubmissions[username] = submissions.filter(sub => sub.username === username); }); - return data; + return userSubmissions; }, async fetchAsCSV() { diff --git a/src/api/admin/usersAPI.js b/src/api/admin/usersAPI.js index d985708..b2acd5e 100644 --- a/src/api/admin/usersAPI.js +++ b/src/api/admin/usersAPI.js @@ -42,5 +42,15 @@ export default { responseType: "blob", url: `/api/info/users?sort=${sortFilter}&filter=${statusFilter}&format=csv` }); + }, + + async getLeaderboard(page = 1) { + const response = await axiosInstance.get(`/api/info/leaderboard?page=${page}`); + return response.data; + }, + + async getUserCount() { + const response = await axiosInstance.get('/api/info/usercount'); + return response.data; } }; diff --git a/src/components/ChallCard.vue b/src/components/ChallCard.vue index 00e350a..ff4121b 100644 --- a/src/components/ChallCard.vue +++ b/src/components/ChallCard.vue @@ -358,6 +358,10 @@ export default { Response.data.error ? Response.data.error : Response.data.message, "Error" ); + // Increment the counter immediately after submission + if (this.challDetails.maxAttemptLimit !== -1) { + this.challDetails.previous_tries++; + } } }); var self = this; diff --git a/src/components/LeaderboardGraph.vue b/src/components/LeaderboardGraph.vue index 3a66029..020b752 100644 --- a/src/components/LeaderboardGraph.vue +++ b/src/components/LeaderboardGraph.vue @@ -1,11 +1,16 @@ diff --git a/src/components/adminTable.vue b/src/components/adminTable.vue index 348efd4..5aa4ae6 100644 --- a/src/components/adminTable.vue +++ b/src/components/adminTable.vue @@ -12,7 +12,8 @@ {{ tableCol.label }} - + + {{ this.userData.rank }} @@ -24,14 +25,13 @@ - - - +
@@ -100,72 +103,109 @@ export default { name: "adminTable", components: {}, + props: { + tableCols: { + type: Array, + required: true + }, + rows: { + type: Array, + required: true + }, + colStyle: { + type: Object, + default: () => ({}) + }, + links: { + type: Array, + default: () => [] + }, + maxElementPerPage: { + type: Number, + default: 25 + }, + userData: { + type: Object, + default: () => ({}) + }, + keys: { + type: String, + default: '' + }, + totalUsers: { + type: Number, + default: 0, + validator: value => value >= 0 + } + }, data() { return { - jumpPage: 1, currentPage: 1, - tableRows: [] + jumpPage: "" }; }, - mounted() { - this.tableRows = this.get_rows(); + watch: { + totalUsers() { + this.currentPage = 1; + this.$emit('page-changed', 1); + }, + currentPage(newPage, oldPage) { + if (newPage !== oldPage) { + this.$emit('page-changed', newPage); + } + } }, - props: [ - "tableCols", - "rows", - "colStyle", - "links", - "maxElementPerPage", - "userData", - "keys" - ], methods: { isColLink(val) { - let isLink = false; - this.links.forEach(item => { - if (item.col === val) { - isLink = true; - } + if (!this.links) return false; + return this.links.some(link => { + const colObj = this.tableCols.find(col => col.id === parseInt(val)); + return colObj && link.col.toLowerCase() === colObj.label.toLowerCase(); }); - return isLink; }, getRedirectLink(val, username) { - var redirectLink = ""; - this.links.forEach(item => { - if (item.col === val) { - redirectLink = item.redirect + username; - } - }); - return redirectLink; + if (!this.links) return ""; + const colObj = this.tableCols.find(col => col.id === parseInt(val)); + if (!colObj) return ""; + + const link = this.links.find(link => link.col.toLowerCase() === colObj.label.toLowerCase()); + if (!link) return ""; + return `${link.redirect}${username}`; }, - changePage() { - this.currentPage = this.jumpPage; - this.tableRows = this.get_rows(); + changePage(e) { + e.preventDefault(); + const page = parseInt(this.jumpPage); + if (page >= 1 && page <= this.pageCount) { + this.currentPage = page; + } + this.jumpPage = ""; }, pageChangeHandler(selectedPage) { - this.currentPage = selectedPage; - this.tableRows = this.get_rows(); + if (selectedPage >= 1 && selectedPage <= this.pageCount) { + this.currentPage = selectedPage; + } }, - get_rows() { - let start = (this.currentPage - 1) * this.maxElementPerPage; - let end = start + this.maxElementPerPage; - return this.rows.slice(start, end); + handlePrevClick() { + if (this.currentPage > 1) { + this.pageChangeHandler(this.currentPage - 1); + } + }, + handleNextClick() { + if (this.currentPage < this.pageCount) { + this.pageChangeHandler(this.currentPage + 1); + } } }, computed: { - columns: function columns() { - if (this.rows.length == 0) { - return []; - } - return Object.keys(this.rows[0]); + tableRows() { + return this.rows; + }, + columns() { + if (!this.tableCols || this.tableCols.length === 0) return []; + return this.tableCols.map(col => col.id); }, pageCount() { - if ( - Math.round(this.rows.length / this.maxElementPerPage) === - this.rows.length / this.maxElementPerPage - ) - return Math.round(this.rows.length / this.maxElementPerPage); - else return Math.floor(this.rows.length / this.maxElementPerPage) + 1; + return Math.max(1, Math.ceil(this.totalUsers / this.maxElementPerPage)); } } }; diff --git a/src/constants/constants.js b/src/constants/constants.js index 93927dc..f186297 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -114,7 +114,7 @@ export const tableCols = { style: { width: "75%", paddingLeft: "2.5rem", - textAlign: "left" + textAlign: "center" } }, { diff --git a/src/styles/modules/_adminTable.scss b/src/styles/modules/_adminTable.scss index 82898f1..38a8265 100644 --- a/src/styles/modules/_adminTable.scss +++ b/src/styles/modules/_adminTable.scss @@ -43,8 +43,8 @@ .adminTableteamName, .adminTableusername { - text-align: left; - padding-left: 2.5rem; + text-align: center; + // padding-left: 2.5rem; } .adminTablechallenge { @@ -176,4 +176,10 @@ text-align: center; border: none; width: 2.5rem; +} + +.activePageItem { + font-weight: bold !important; + background-color: var(--theme-color-dark-blue-high-transp) !important; + color: var(--theme-color-light-blue) !important; } \ No newline at end of file diff --git a/src/views/Leaderboard.vue b/src/views/Leaderboard.vue index 3fec056..74d0871 100644 --- a/src/views/Leaderboard.vue +++ b/src/views/Leaderboard.vue @@ -19,15 +19,17 @@
- +
No Users @@ -41,14 +43,14 @@ + + + \ No newline at end of file diff --git a/src/views/Register.vue b/src/views/Register.vue index 9990e9d..7880945 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -12,21 +12,9 @@
Setup Email
@@ -41,17 +29,8 @@ Please enter the OTP sent to {{ email }}
- -
@@ -68,23 +47,10 @@
-
+
Next - - + +
@@ -94,50 +60,25 @@
- + Back
- +
- +
{{ UsernameErr }}
-
+
Next - - + +
@@ -147,62 +88,39 @@
- + Back
- +
{{ PassLen }}
- +
{{ PassErr }}
-
-
+
1
Setup Email
-
+
2
Basic Info
@@ -317,31 +235,31 @@ export default { }, async sendOTP() { if (this.canProceedToOTP) { - this.otpSent = true; const otpResponse = await VerifyOTP.sendOTP(this.email); - this.startTimer(); if (otpResponse.status !== 200) { - this.$vToastify.error(otpResponse.data.message, "Error"); + this.$vToastify.error(otpResponse.data.error, "Error"); } else { + this.otpSent = true; + this.startTimer(); this.$vToastify.success("OTP sent to your email", "Success"); } } }, async verifyOTP() { - this.OtpErr = ""; - const otpResponse = await VerifyOTP.verifyOTP(this.email, this.otp); - if (otpResponse.status !== 200) { - this.$vToastify.error(otpResponse.data.message, "Error"); - } else { + this.OtpErr = ""; + const otpResponse = await VerifyOTP.verifyOTP(this.email, this.otp); + if (otpResponse.status !== 200) { + this.$vToastify.error(otpResponse.data.error, "Error"); + } else { this.otpVerified = true; this.$vToastify.success("Email verified successfully", "Success"); this.currentStep = 2; if (this.timerInterval) { clearInterval(this.timerInterval); } - } - + } + }, proceedToBasicInfo() { if (this.otpVerified) { @@ -365,7 +283,6 @@ export default { }, async register() { if (this.canRegister && !this.registered) { - console.log(this.uname, this.username, this.email, this.password); const registerResponse = await RegisterUser.registerUser( this.uname, this.username, From e998ff670a4caf65861d2295b442301ef6f7f15e Mon Sep 17 00:00:00 2001 From: SomyaChawla0250 Date: Thu, 13 Feb 2025 04:25:39 +0530 Subject: [PATCH 17/25] minor fix --- src/views/ForgetPassword.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/ForgetPassword.vue b/src/views/ForgetPassword.vue index a77206b..69f6b98 100644 --- a/src/views/ForgetPassword.vue +++ b/src/views/ForgetPassword.vue @@ -90,7 +90,7 @@ export default { components: { ErrorBox, Button }, data() { return { - currentStep: 2, + currentStep: 1, msg: null, icon: null, email: "", @@ -98,7 +98,7 @@ export default { confirmPassword: "", otp: "", otpSent: false, - otpVerified: true, + otpVerified: false, EmailErr: "", PassLen: "", PassErr: "", From 3d390168aa1e79a469bc3d953bd0428c7de5e1d9 Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 13 Feb 2025 06:22:03 +0530 Subject: [PATCH 18/25] Fixes forget password route token auth Signed-off-by: Arshdeep54 --- src/api/admin/authAPI.js | 9 +++++---- src/api/axiosInstance.js | 2 ++ src/views/ForgetPassword.vue | 23 +++++++++++++++++++++++ src/views/Reset.vue | 12 +++++------- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/api/admin/authAPI.js b/src/api/admin/authAPI.js index 419dd70..3d4b299 100644 --- a/src/api/admin/authAPI.js +++ b/src/api/admin/authAPI.js @@ -67,11 +67,12 @@ export default { }, async resetPassword(newPassword) { - const response = await this.resetPass(newPassword); - if (response.status === 200) { - return true; + try { + const response = await this.resetPass(newPassword); + return response; + } catch (error) { + throw error; } - return false; }, getUserInfo() { diff --git a/src/api/axiosInstance.js b/src/api/axiosInstance.js index 7acc688..7cd82de 100644 --- a/src/api/axiosInstance.js +++ b/src/api/axiosInstance.js @@ -31,7 +31,9 @@ axiosInstance.interceptors.response.use( "/auth/login", "/auth/register", "/auth/send-otp", + "/auth/reset-password", "/auth/verify-otp", + "/auth/verify-otp-forget", "/api/submit/challenge" ]; diff --git a/src/views/ForgetPassword.vue b/src/views/ForgetPassword.vue index 69f6b98..3738351 100644 --- a/src/views/ForgetPassword.vue +++ b/src/views/ForgetPassword.vue @@ -116,6 +116,19 @@ export default { }, }, methods: { + startTimer() { + this.timer = 60; + if (this.timerInterval) { + clearInterval(this.timerInterval); + } + this.timerInterval = setInterval(() => { + if (this.timer > 0) { + this.timer--; + } else { + clearInterval(this.timerInterval); + } + }, 1000); + }, validateEmail() { const iitrEmailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.iitr\.ac\.in$/; if (!this.email) { @@ -153,6 +166,16 @@ export default { this.otpVerified = true; this.$vToastify.success("OTP verified successfully", "Success"); this.currentStep = 2; + + const { token, role } = otpResponse.data; + var userInfo = { + token: token, + login: true, + access: true, + role: role + }; + localStorage.setItem("userInfo", JSON.stringify(userInfo)); + } }, proceedToResetPassword() { diff --git a/src/views/Reset.vue b/src/views/Reset.vue index d409abf..5e63905 100644 --- a/src/views/Reset.vue +++ b/src/views/Reset.vue @@ -86,19 +86,17 @@ export default { this.$vToastify.error("Passwords don't match", "Error"); } else { this.PassErr = false; - const state = await LoginUser.resetPassword(this.password); - if (state) { + + const resetResponse = await LoginUser.resetPassword(this.password); + if (resetResponse.status !== 200) { + this.$vToastify.error(resetResponse.data.message, "Error"); + } else { this.$vToastify.setSettings({ theme: "beast-success" }); this.$vToastify.success("Successfully changed", "Success"); await this.sleep(3000); this.$router.push("/about"); - } else { - this.$vToastify.setSettings({ - theme: "beast-error" - }); - this.$vToastify.error("Unauthorized access", "Error"); } } } From d355cbf0e070302983574a00a76c7d0f27595ab0 Mon Sep 17 00:00:00 2001 From: SomyaChawla0250 Date: Thu, 13 Feb 2025 07:19:46 +0530 Subject: [PATCH 19/25] fixes: styling of reset password button --- src/views/ForgetPassword.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ForgetPassword.vue b/src/views/ForgetPassword.vue index 3738351..808fed8 100644 --- a/src/views/ForgetPassword.vue +++ b/src/views/ForgetPassword.vue @@ -70,7 +70,7 @@
-
From c50984b76a42eb3263488e364d5e29cc15f3e19a Mon Sep 17 00:00:00 2001 From: sukhman Date: Thu, 13 Feb 2025 07:45:47 +0530 Subject: [PATCH 20/25] Fix chall config --- src/components/ChallCard.vue | 3 ++- src/views/AdminChallenge.vue | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ChallCard.vue b/src/components/ChallCard.vue index 086cd97..afd1edc 100644 --- a/src/components/ChallCard.vue +++ b/src/components/ChallCard.vue @@ -248,7 +248,8 @@ export default { let ncurl = CONFIG.ncRoot; if ( this.challDetails.category === "service" || - this.challDetails.category === "xinetd" + this.challDetails.category === "xinetd" || + this.challDetails.category === "service_docker" ) { if (this.challDetails.deployedLink == "localhost" || this.challDetails.deployedLink == "") { return `nc ${ncurl} ${port}`; diff --git a/src/views/AdminChallenge.vue b/src/views/AdminChallenge.vue index 144941a..aa7557a 100644 --- a/src/views/AdminChallenge.vue +++ b/src/views/AdminChallenge.vue @@ -239,8 +239,9 @@ export default { let url = CONFIG.webRoot; let ncurl = CONFIG.ncRoot; if ( - this.chalDetails.category === "service" || - this.chalDetails.category === "xinetd" + this.challDetails.category === "service" || + this.challDetails.category === "xinetd" || + this.challDetails.category === "service_docker" ) { return `nc ${ncurl} ${port}`; } From 67eb03276df1f3dd89e0d28b24f2981c8bbb33d2 Mon Sep 17 00:00:00 2001 From: Aryan Date: Thu, 13 Feb 2025 08:56:58 +0530 Subject: [PATCH 21/25] Integrates route to send forgot password otp --- src/api/admin/otpAPI.js | 17 +++++++++++++++-- src/views/ForgetPassword.vue | 2 +- src/views/Register.vue | 29 ++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/api/admin/otpAPI.js b/src/api/admin/otpAPI.js index 85656ca..b014993 100644 --- a/src/api/admin/otpAPI.js +++ b/src/api/admin/otpAPI.js @@ -17,7 +17,6 @@ export default { throw error; } }, - async verifyOTP(email, otp) { let bodyFormData = new FormData(); bodyFormData.append("email", email); @@ -35,7 +34,21 @@ export default { throw error; } }, - + async sendOTPForForget(email) { + let bodyFormData = new FormData(); + bodyFormData.append("email", email); + + try { + const response = await axiosInstance({ + method: "post", + url: `/auth/send-otp-forget`, + data: bodyFormData, + }); + return response; + } catch (error) { + throw error; + } + }, async verifyOTPForForget(email, otp) { let bodyFormData = new FormData(); bodyFormData.append("email", email); diff --git a/src/views/ForgetPassword.vue b/src/views/ForgetPassword.vue index 808fed8..4cb8932 100644 --- a/src/views/ForgetPassword.vue +++ b/src/views/ForgetPassword.vue @@ -147,7 +147,7 @@ export default { }, async sendOTP() { if (this.canProceedToOTP) { - const otpResponse = await VerifyOTP.sendOTP(this.email); + const otpResponse = await VerifyOTP.sendOTPForForget(this.email); if (otpResponse.status !== 200) { this.$vToastify.error(otpResponse.data.error, "Error"); } else { diff --git a/src/views/Register.vue b/src/views/Register.vue index 9360755..5083b0f 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -239,10 +239,15 @@ export default { if (otpResponse.status !== 200) { this.$vToastify.error(otpResponse.data.error, "Error"); } else { - this.otpSent = true; - this.startTimer(); - this.$vToastify.success("OTP sent to your email", "Success"); - + if (otpResponse.data.message === "Email already verified") { + this.otpVerified = true; + this.$vToastify.success("Email already verified", "Success"); + this.currentStep = 2; + } else { + this.otpSent = true; + this.startTimer(); + this.$vToastify.success("OTP sent to your email", "Success"); + } } } }, @@ -253,11 +258,17 @@ export default { if (otpResponse.status !== 200) { this.$vToastify.error(otpResponse.data.error, "Error"); } else { - this.otpVerified = true; - this.$vToastify.success("Email verified successfully", "Success"); - this.currentStep = 2; - if (this.timerInterval) { - clearInterval(this.timerInterval); + if (otpResponse.data.message === "Email already verified") { + this.otpVerified = true; + this.$vToastify.success("Email already verified", "Success"); + this.currentStep = 2; + } else { + this.otpVerified = true; + this.$vToastify.success("Email verified successfully", "Success"); + this.currentStep = 2; + if (this.timerInterval) { + clearInterval(this.timerInterval); + } } } }, From d809a5bb4d2b394824f3ab21f9e5c29d7c651d15 Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 13 Feb 2025 10:39:55 +0530 Subject: [PATCH 22/25] Fix rendering in Users and Submissions Signed-off-by: Arshdeep54 --- src/views/AdminSubmissions.vue | 35 ++++++++++++++---- src/views/AdminUsers.vue | 67 ++++++++++++++++++++++------------ 2 files changed, 70 insertions(+), 32 deletions(-) diff --git a/src/views/AdminSubmissions.vue b/src/views/AdminSubmissions.vue index 0072ff4..4168466 100644 --- a/src/views/AdminSubmissions.vue +++ b/src/views/AdminSubmissions.vue @@ -12,11 +12,13 @@ :tableCols="tableCols" :rows="rows" :links="[ - { col: 'challenge', redirect: '/admin/challenges/' }, - { col: 'username', redirect: '/admin/users/' } + { col: '2', redirect: '/admin/challenges/' }, + { col: '1', redirect: '/admin/users/' } ]" :maxElementPerPage="20" + :total-users="totalSubmissions" v-if="this.rows.length > 0 && !loading" + @page-changed="onPageChange" />
{ utils.saveAsFile(res.data, "submissions.csv", "text/csv"); }); + }, + async fetchUsers(page = 1) { + this.loading = true; + this.displaySubmissions = this.submissions.slice((page - 1) * 10, page * 10); + this.loading = false; + this.rows = this.displaySubmissions; } }, async mounted() { let response = await SubmissionService.getSubmissions(); var submissions = []; + console.log(response); response.forEach((element, index) => { submissions.push({ - username: element.username, - challenge: element.name, - tags: getChalTags(element.tags), - timeDate: element.solvedTime + "1": element.username, + "2": element.name, + "3": getChalTags(element.tags), + "4": element.solvedTime }); }); - this.rows = submissions; + this.submissions = submissions; + this.totalSubmissions = submissions.length; this.loading = false; + this.fetchUsers(1); }, beforeCreate() { this.$store.commit("updateCurrentPage", "adminSubmissions"); diff --git a/src/views/AdminUsers.vue b/src/views/AdminUsers.vue index 2f20d18..37bc030 100644 --- a/src/views/AdminUsers.vue +++ b/src/views/AdminUsers.vue @@ -55,6 +55,8 @@ :links="[{ col: 'username', redirect: '/admin/users/' }]" :maxElementPerPage="10" :key="reload + searchQuery" + :total-users="totalUsers" + @page-changed="onPageChange" />
{ - this.users = users; - this.displayUsers = this.users.sort((a, b) => { - return a.username > b.username ? 1 : -1; - }); + this.users = users.map(element => ({ + "1": element.rank, + "2": element.username, + "3": element.email, + "4": element.score, + "5": element.status + })); + this.applySort(); + this.totalUsers = this.users.length; + this.fetchUsers(1); }) .finally(() => { this.loading = false; }); }, methods: { + onPageChange(page) { + this.fetchUsers(page); + }, + async fetchUsers(page = 1) { + const filteredAndSortedUsers = this.applySort([...this.users]); + this.displayUsers = filteredAndSortedUsers.slice((page - 1) * 10, page * 10); + this.totalUsers = filteredAndSortedUsers.length; + }, changeFilter(value) { - this.reload = !this.reload; this.statusFilter = value; - if (value === "All") { - this.displayUsers = this.users; - } else { - this.displayUsers = this.users.filter(el => { - return el.status == value; - }); - } + this.reload = !this.reload; + this.fetchUsers(1); }, changeSort(value) { - this.reload = !this.reload; this.sortFilter = value; - if (value === "User Name") { - this.displayUsers = this.displayUsers.sort((a, b) => { - return a.username.toLowerCase() > b.username.toLowerCase() ? 1 : -1; - }); - } else if (value === "Score") { - this.displayUsers = this.displayUsers.sort((a, b) => { - return a.rank - b.rank; - }); + this.reload = !this.reload; + this.fetchUsers(1); + }, + applySort(users = this.users) { + let filtered = [...users]; + + // Apply status filter + if (this.statusFilter !== "All") { + filtered = filtered.filter(user => user["5"] === this.statusFilter); + } + + // Apply sorting + if (this.sortFilter === "User Name") { + filtered.sort((a, b) => a["2"].localeCompare(b["2"])); + } else if (this.sortFilter === "Score") { + filtered.sort((a, b) => b["4"] - a["4"]); } + + return filtered; }, async exportUsersAsCSV() { let jsonObject = JSON.stringify(this.resultQuery); @@ -152,7 +171,7 @@ export default { return this.searchQuery .toLowerCase() .split(" ") - .every(v => item.username.toLowerCase().includes(v)); + .every(v => item["2"].toLowerCase().includes(v)); }); } else { return this.displayUsers; From 4790130462575e2bb4b4637b0916c838f78b52e9 Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 13 Feb 2025 11:02:09 +0530 Subject: [PATCH 23/25] Fix rendering in Challenge page Signed-off-by: Arshdeep54 --- src/api/admin/submissionsAPI.js | 1 - src/views/AdminChallenge.vue | 105 +++++++++++++++++++------------- src/views/AdminLeaderboard.vue | 3 - src/views/AdminSubmissions.vue | 1 - 4 files changed, 63 insertions(+), 47 deletions(-) diff --git a/src/api/admin/submissionsAPI.js b/src/api/admin/submissionsAPI.js index 5accb19..ed7b9a5 100644 --- a/src/api/admin/submissionsAPI.js +++ b/src/api/admin/submissionsAPI.js @@ -16,7 +16,6 @@ export default { // Group submissions by username for efficient processing groupSubmissionsByUsers(submissions, usernames) { - console.log("Called",submissions); const userSubmissions = {}; usernames.forEach(username => { userSubmissions[username] = submissions.filter(sub => sub.username === username); diff --git a/src/views/AdminChallenge.vue b/src/views/AdminChallenge.vue index aa7557a..b552c87 100644 --- a/src/views/AdminChallenge.vue +++ b/src/views/AdminChallenge.vue @@ -164,11 +164,13 @@
Submissions
No Submissions @@ -218,30 +220,34 @@ export default { tableCols: tableCols.adminChallenge, rows: [], chalDetails: {}, + currentPage: 1, confirmDialogs: confimDialogMessages(this.$route.params.id) .adminChallenge, hostUrl: this.$store.getters.hostUrl, - copyText: "Click to Copy" + copyText: "Click to Copy", + submissions: [] }; }, computed: { - isLoading: function() { - for (let apiState in this.loading) { - if (this.loading[apiState]) { - return true; - } - } - return false; + isLoading() { + return ( + this.loading.usersNotFetched || + this.loading.challengeNotFetched || + this.loading.submissionsNotFetched + ); } }, methods: { + setLoadingState(key, value) { + this.$set(this.loading, key, value); + }, getUrl(port) { let url = CONFIG.webRoot; let ncurl = CONFIG.ncRoot; if ( - this.challDetails.category === "service" || - this.challDetails.category === "xinetd" || - this.challDetails.category === "service_docker" + this.chalDetails.category === "service" || + this.chalDetails.category === "xinetd" || + this.chalDetails.category === "service_docker" ) { return `nc ${ncurl} ${port}`; } @@ -345,6 +351,15 @@ export default { setTimeout(() => { this.copyText = "Click to Copy"; }, 1000); + }, + onPageChange(page) { + this.currentPage = page; + this.fetchUsers(page); + }, + fetchUsers(page) { + this.loading.usersNotFetched = true; + this.rows=this.submissions.slice((page - 1) * 10, page * 10); + this.loading.usersNotFetched = false; } }, mounted() { @@ -354,36 +369,42 @@ export default { ) this.link = false; else this.link = true; - UsersService.getUserStats() - .then(response => { - this.activeUsers = response.data.unbanned_users; - }) - .finally(() => { - this.loading.usersNotFetched = false; - }); - ChalService.fetchChallengeByName(this.$route.params.id) - .then(response => { - let data = response.data; - this.chalDetails = data; - }) - .finally(() => { - this.loading.challengeNotFetched = false; - }); - SubmissionService.getSubmissions() - .then(response => { - response.forEach(element => { - if (element.name == this.$route.params.id) { - this.rows.push({ - username: element.username, - timeDateRight: element.solvedTime - }); - } - }); - }) - .finally(() => { - this.loading.submissionsNotFetched = false; - }); + Promise.all([ + // Fetch user stats + UsersService.getUserStats() + .then(response => { + this.activeUsers = response.data.unbanned_users; + }) + .finally(() => { + this.setLoadingState("usersNotFetched", false); + }), + + // Fetch challenge details + ChalService.fetchChallengeByName(this.$route.params.id) + .then(response => { + this.chalDetails = response.data; + }) + .finally(() => { + this.setLoadingState("challengeNotFetched", false); + }), + + // Fetch submissions + SubmissionService.getSubmissions() + .then(response => { + this.rows = response + .filter(element => element.name === this.$route.params.id) + .map(element => ({ + "1": element.username, + "2": element.solvedTime + })); + this.submissions = this.rows; + }) + .finally(() => { + this.setLoadingState("submissionsNotFetched", false); + this.fetchUsers(1); + }) + ]); }, beforeCreate() { this.$store.commit("updateCurrentPage", "adminChallenges"); diff --git a/src/views/AdminLeaderboard.vue b/src/views/AdminLeaderboard.vue index 8ce05f8..e524d2b 100644 --- a/src/views/AdminLeaderboard.vue +++ b/src/views/AdminLeaderboard.vue @@ -78,7 +78,6 @@ export default { async fetchTotalUsers() { try { const response = await UsersService.getUserCount(); - console.log("Fetching user count", response); this.totalUsers = response.user_count || 0; } catch (err) { console.error('Error fetching user count:', err); @@ -89,7 +88,6 @@ export default { this.loading = true; try { const users = await UsersService.getLeaderboard(page); - console.log("Fetching users", users); if (!users || users.length === 0) { this.users = []; this.displayUsers = []; @@ -106,7 +104,6 @@ export default { this.users = []; this.displayUsers = []; } finally { - console.log("Finished fetching users"); this.loading = false; } }, diff --git a/src/views/AdminSubmissions.vue b/src/views/AdminSubmissions.vue index 4168466..f28fc36 100644 --- a/src/views/AdminSubmissions.vue +++ b/src/views/AdminSubmissions.vue @@ -75,7 +75,6 @@ export default { async mounted() { let response = await SubmissionService.getSubmissions(); var submissions = []; - console.log(response); response.forEach((element, index) => { submissions.push({ "1": element.username, From 6fcf5bd3b7a36687bd7533473e511d3388723d3c Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 13 Feb 2025 13:54:19 +0530 Subject: [PATCH 24/25] Fix user submission Signed-off-by: Arshdeep54 --- src/api/admin/submissionsAPI.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/api/admin/submissionsAPI.js b/src/api/admin/submissionsAPI.js index ed7b9a5..d721f1a 100644 --- a/src/api/admin/submissionsAPI.js +++ b/src/api/admin/submissionsAPI.js @@ -29,5 +29,12 @@ export default { responseType: "blob", url: `/api/info/submissions?format=csv` }); + }, + + async getUserSubs(username) { + const submissions = await this.getSubmissions(); + const submission = submissions.filter(sub => sub.username === username); + console.log(submission); + return submission; } }; From 75181bebd0b6b327c022ae2a9185966ca2330c6f Mon Sep 17 00:00:00 2001 From: Arshdeep54 Date: Thu, 13 Feb 2025 14:32:22 +0530 Subject: [PATCH 25/25] Fix admin link to user Signed-off-by: Arshdeep54 --- src/views/AdminUsers.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/AdminUsers.vue b/src/views/AdminUsers.vue index 37bc030..85ce55e 100644 --- a/src/views/AdminUsers.vue +++ b/src/views/AdminUsers.vue @@ -52,7 +52,7 @@ v-if="this.resultQuery.length > 0 && !loading" :tableCols="tableCols" :rows="resultQuery" - :links="[{ col: 'username', redirect: '/admin/users/' }]" + :links="[{ col: 'user name', redirect: '/admin/users/' }]" :maxElementPerPage="10" :key="reload + searchQuery" :total-users="totalUsers"