- {{ user.username }}: {{ user.score }} {{ user.completedQuests }}
+
+
+
+
+
+
+
+
+
排行榜
+
+
+
+
+ | 使用者名稱 |
+ 分數 |
+ 完成關卡 |
+
+
+
+
+ |
+ {{ user.username }}
+ |
+ {{ user.score }} |
+
+
+ {{ quest }}
+
+ |
+
+
+
+
+
diff --git a/server/src/api/controllers/leaderboardController.js b/server/src/api/controllers/leaderboardController.js
index 4f497a1..bf56a79 100644
--- a/server/src/api/controllers/leaderboardController.js
+++ b/server/src/api/controllers/leaderboardController.js
@@ -8,5 +8,10 @@ export default asyncHandler(async (req, res) => {
completedQuests: user.completedQuests,
score: user.score * 1000,
}))
- res.json(response)
+ // duplicate the response 100 times
+ const fakeResponse = []
+ for (let i = 0; i < 100; i++) {
+ fakeResponse.push(...response)
+ }
+ res.json(fakeResponse)
})
From dd3e6b4aac37029c4331d275d0dccd94a2881e45 Mon Sep 17 00:00:00 2001
From: "Chen, Tai-Lin"
Date: Thu, 23 Nov 2023 16:50:07 +0800
Subject: [PATCH 12/23] scroll leader board
---
app/src/views/LeaderboardPage.vue | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/src/views/LeaderboardPage.vue b/app/src/views/LeaderboardPage.vue
index 86ff408..8373bae 100644
--- a/app/src/views/LeaderboardPage.vue
+++ b/app/src/views/LeaderboardPage.vue
@@ -32,12 +32,12 @@ onMounted(async () => {
-
+
排行榜
-
+
Date: Thu, 23 Nov 2023 16:51:18 +0800
Subject: [PATCH 13/23] set back if completed
---
app/src/views/GamePage.vue | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/src/views/GamePage.vue b/app/src/views/GamePage.vue
index e641e93..b307d05 100644
--- a/app/src/views/GamePage.vue
+++ b/app/src/views/GamePage.vue
@@ -90,8 +90,7 @@ onMounted(async () => {
-
-
+
From a7eeb8470aff3f71f7b61f198271405bb9c14565 Mon Sep 17 00:00:00 2001
From: Annie Huang
Date: Thu, 23 Nov 2023 16:55:34 +0800
Subject: [PATCH 14/23] edit link text
---
tests/cypress/e2e/helloworld.cy.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/cypress/e2e/helloworld.cy.js b/tests/cypress/e2e/helloworld.cy.js
index aaba53f..5c5890b 100644
--- a/tests/cypress/e2e/helloworld.cy.js
+++ b/tests/cypress/e2e/helloworld.cy.js
@@ -187,7 +187,7 @@ describe('example helloworld app', () => {
// Check survey dialog pop up
cy.CheckTextElement('#QuestCompleted', '關卡完成!', 'Quest Completed!')
cy.get('div[class="modal"]').find('p').should('be.visible')
- cy.findByRole('link', { name: '填寫問卷' }).should('be.visible')
+ cy.findByRole('link', { name: '回到地圖' }).should('be.visible')
})
})
})
From 84cf74cdfcbc8313a4864088ee3ad8df04929e6e Mon Sep 17 00:00:00 2001
From: Annie Huang
Date: Thu, 23 Nov 2023 17:00:30 +0800
Subject: [PATCH 15/23] extend timeout
---
tests/cypress/e2e/helloworld.cy.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/cypress/e2e/helloworld.cy.js b/tests/cypress/e2e/helloworld.cy.js
index 5c5890b..a152066 100644
--- a/tests/cypress/e2e/helloworld.cy.js
+++ b/tests/cypress/e2e/helloworld.cy.js
@@ -187,7 +187,9 @@ describe('example helloworld app', () => {
// Check survey dialog pop up
cy.CheckTextElement('#QuestCompleted', '關卡完成!', 'Quest Completed!')
cy.get('div[class="modal"]').find('p').should('be.visible')
- cy.findByRole('link', { name: '回到地圖' }).should('be.visible')
+ cy.findByRole('link', { name: '回到地圖' }, { timeout: 30000 }).should(
+ 'be.visible'
+ )
})
})
})
From 88d19e7f8760aae7e3e8c3ebfd8fac447e44896f Mon Sep 17 00:00:00 2001
From: "Lin, Hung-Shin"
Date: Thu, 23 Nov 2023 22:22:48 +0800
Subject: [PATCH 16/23] fix: navbar overlap leaderboard
---
app/src/views/LeaderboardPage.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/views/LeaderboardPage.vue b/app/src/views/LeaderboardPage.vue
index 8373bae..cf50a95 100644
--- a/app/src/views/LeaderboardPage.vue
+++ b/app/src/views/LeaderboardPage.vue
@@ -29,10 +29,10 @@ onMounted(async () => {
-
+
-
+
From 52fa8d6f3a12a2f99fb95d619f1da44b99f3a8fa Mon Sep 17 00:00:00 2001
From: "Lin, Hung-Shin"
Date: Thu, 23 Nov 2023 22:28:23 +0800
Subject: [PATCH 17/23] fix: put leadeboard align top
---
app/src/views/LeaderboardPage.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/views/LeaderboardPage.vue b/app/src/views/LeaderboardPage.vue
index cf50a95..dcba85e 100644
--- a/app/src/views/LeaderboardPage.vue
+++ b/app/src/views/LeaderboardPage.vue
@@ -34,7 +34,7 @@ onMounted(async () => {
排行榜
From 9e7065fbd74bc036213a12105dd105d381209584 Mon Sep 17 00:00:00 2001
From: "Lin, Hung-Shin"
Date: Thu, 23 Nov 2023 22:28:36 +0800
Subject: [PATCH 18/23] fix: remove fake leaderboard responses
---
server/src/api/controllers/leaderboardController.js | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/server/src/api/controllers/leaderboardController.js b/server/src/api/controllers/leaderboardController.js
index bf56a79..4f497a1 100644
--- a/server/src/api/controllers/leaderboardController.js
+++ b/server/src/api/controllers/leaderboardController.js
@@ -8,10 +8,5 @@ export default asyncHandler(async (req, res) => {
completedQuests: user.completedQuests,
score: user.score * 1000,
}))
- // duplicate the response 100 times
- const fakeResponse = []
- for (let i = 0; i < 100; i++) {
- fakeResponse.push(...response)
- }
- res.json(fakeResponse)
+ res.json(response)
})
From 66adfec365268ed815a9ccd1ef896e6fad7bdce3 Mon Sep 17 00:00:00 2001
From: Annie Huang
Date: Thu, 23 Nov 2023 22:48:26 +0800
Subject: [PATCH 19/23] fix method
---
app/src/components/CompleteModal.vue | 4 ++--
app/src/components/QuestMap.vue | 21 ++++++---------------
2 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/app/src/components/CompleteModal.vue b/app/src/components/CompleteModal.vue
index 81e632d..057a474 100644
--- a/app/src/components/CompleteModal.vue
+++ b/app/src/components/CompleteModal.vue
@@ -8,7 +8,7 @@ import CompleteAnimation from '../img/complete-animation.json'
const showModal = ref(true) // Controls whether the modal is visible or not
const router = useRouter()
-
+const toast = useToast()
const closeModal = () => {
showModal.value = false
}
@@ -27,7 +27,7 @@ const backtoMap = async () => {
router.push({ name: 'map' })
} catch (err) {
// useToast().error('Failed to load map')
- useToast().error('無法讀取地圖')
+ toast.error('無法讀取地圖')
console.error(err)
}
}
diff --git a/app/src/components/QuestMap.vue b/app/src/components/QuestMap.vue
index 40e9a46..734c2ab 100644
--- a/app/src/components/QuestMap.vue
+++ b/app/src/components/QuestMap.vue
@@ -77,22 +77,13 @@ const genOption = (nodes, edges) => ({
const {
data: { completed, unlocked },
} = params
- switch (completed !== unlocked) {
- case false: {
- // completed==unlocked, when completed or not yet unlocked
- if (completed) {
- return '#00ff00'
- }
- return '#454552'
- }
- case true: {
- // completed!=unlocked, only when unlocked but not completed
- return '#ADADB5'
- }
- default: {
- return '#454552'
- }
+ if (completed) {
+ return '#00ff00'
}
+ if (unlocked) {
+ return '#ADADB5'
+ }
+ return '454552'
},
},
},
From 96c0785a7e1db0638ca8351690a382d7ad4a091b Mon Sep 17 00:00:00 2001
From: "Chen, Tai-Lin"
Date: Thu, 23 Nov 2023 23:26:11 +0800
Subject: [PATCH 20/23] change e2e test
---
tests/cypress/e2e/helloworld.cy.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tests/cypress/e2e/helloworld.cy.js b/tests/cypress/e2e/helloworld.cy.js
index aaba53f..dd35431 100644
--- a/tests/cypress/e2e/helloworld.cy.js
+++ b/tests/cypress/e2e/helloworld.cy.js
@@ -78,9 +78,7 @@ describe('example helloworld app', () => {
cy.PrepareForGame()
})
it('Check Header', () => {
- cy.get('#HeaderText')
- .should('contain', 'Hello, Linux World!')
- .and('be.visible')
+ cy.get('#HeaderText').should('contain', 'Linux Odyssey').and('be.visible')
cy.findByRole('link', { name: 'Bug Report' }).should('be.visible')
cy.findByRole('button', { name: 'Sign Out' }).should('be.visible')
})
From 277d619518729ae50843f08f95f00e356334948c Mon Sep 17 00:00:00 2001
From: Annie Huang
Date: Thu, 23 Nov 2023 23:27:58 +0800
Subject: [PATCH 21/23] fix cypress fail
---
tests/cypress/e2e/helloworld.cy.js | 6 ++----
tests/cypress/support/commands.js | 14 +++++++++-----
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/tests/cypress/e2e/helloworld.cy.js b/tests/cypress/e2e/helloworld.cy.js
index a152066..1dfcb9c 100644
--- a/tests/cypress/e2e/helloworld.cy.js
+++ b/tests/cypress/e2e/helloworld.cy.js
@@ -137,7 +137,7 @@ describe('example helloworld app', () => {
it('Typing in Terminal', () => {
cy.typeInCommand('12345{enter}')
cy.get('@Terminaltextbox')
- .should('contain', 'zsh: command not found: 12345')
+ .should('contain', 'zsh: command not found: 12345', { timeout: 50000 })
.and('contain', '12345')
})
it('Complete the Game(relating UI)', () => {
@@ -187,9 +187,7 @@ describe('example helloworld app', () => {
// Check survey dialog pop up
cy.CheckTextElement('#QuestCompleted', '關卡完成!', 'Quest Completed!')
cy.get('div[class="modal"]').find('p').should('be.visible')
- cy.findByRole('link', { name: '回到地圖' }, { timeout: 30000 }).should(
- 'be.visible'
- )
+ cy.get('#BacktoMap').should('contain', '回到地圖').and('be.visible')
})
})
})
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index de19392..9edb868 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -9,13 +9,21 @@ Cypress.Commands.add('LoginWithPassword', (username, password) => {
})
Cypress.Commands.add('PrepareForGame', () => {
cy.visit('/')
+ // make sure the login page is loaded
+ cy.url().should('satisfy', (elements) => {
+ const text = elements
+ return text.includes('login') || text.includes('register')
+ })
cy.LoginWithPassword(
Cypress.env('defaultAccount'),
Cypress.env('defaultPassword')
)
+ // make sure the map page is loaded
cy.url().should('include', '/map')
cy.visit('/game/helloworld')
- cy.get('.xterm-screen', { timeout: 10000 })
+ // make sure the game page is loaded
+ cy.url().should('include', '/game/helloworld')
+ cy.get('.xterm-screen', { timeout: 30000 })
.as('Terminaltextbox')
.should('be.visible')
cy.CheckTextElement('#reset', '重來', 'Reset').click()
@@ -24,10 +32,6 @@ Cypress.Commands.add('PrepareForGame', () => {
'contain',
'commander:~ $'
)
- cy.get('@Terminaltextbox', { timeout: 150000 }).should(
- 'contain',
- 'commander:~ $'
- )
})
Cypress.Commands.add('typeInCommand', (command) => {
cy.get('.xterm-screen', { timeout: 150000 }).type(command)
From 1944a69b5311dfd052dc902f48bc74f10fd1ff97 Mon Sep 17 00:00:00 2001
From: Annie Huang
Date: Thu, 23 Nov 2023 23:30:38 +0800
Subject: [PATCH 22/23] extend timeout
---
tests/cypress/support/commands.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index 9edb868..c5e99d1 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -23,7 +23,7 @@ Cypress.Commands.add('PrepareForGame', () => {
cy.visit('/game/helloworld')
// make sure the game page is loaded
cy.url().should('include', '/game/helloworld')
- cy.get('.xterm-screen', { timeout: 30000 })
+ cy.get('.xterm-screen', { timeout: 50000 })
.as('Terminaltextbox')
.should('be.visible')
cy.CheckTextElement('#reset', '重來', 'Reset').click()
From fe604f37816e26cbeddd256e45f0dc9d8ea9307b Mon Sep 17 00:00:00 2001
From: Annie Huang
Date: Thu, 23 Nov 2023 23:36:30 +0800
Subject: [PATCH 23/23] change verify order
---
tests/cypress/e2e/helloworld.cy.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/cypress/e2e/helloworld.cy.js b/tests/cypress/e2e/helloworld.cy.js
index 1dfcb9c..533ae77 100644
--- a/tests/cypress/e2e/helloworld.cy.js
+++ b/tests/cypress/e2e/helloworld.cy.js
@@ -137,8 +137,8 @@ describe('example helloworld app', () => {
it('Typing in Terminal', () => {
cy.typeInCommand('12345{enter}')
cy.get('@Terminaltextbox')
- .should('contain', 'zsh: command not found: 12345', { timeout: 50000 })
- .and('contain', '12345')
+ .should('contain', '12345')
+ .and('contain', 'zsh: command not found: 12345', { timeout: 50000 })
})
it('Complete the Game(relating UI)', () => {
// get answersheet