feat: disable quest locks when testing

This commit is contained in:
Lin, Hung-Shin committed 2023-11-21 10:48:35 +08:00
1 parent c7fb0997b7
commit 3f8bcb5446
3 files changed
+4 -4

No files matched your search

+1 -2
View File
@@ -1,3 +1,2 @@
title: Read the File title: 建立檔案與資料夾
instruction: | instruction: |
閱讀檔案
+1 -1
View File
@@ -3,8 +3,8 @@ quests:
- cast - cast
- discover - discover
- read - read
- create
- transport - transport
- create
- copy - copy
- move - move
- remove - remove
@@ -6,6 +6,7 @@ import {
isQuestUnlocked, isQuestUnlocked,
} from '../../models/sessionManager.js' } from '../../models/sessionManager.js'
import { asyncHandler } from '../../middleware/error.js' import { asyncHandler } from '../../middleware/error.js'
import config from '../../config.js'
function sessionSummary(session) { function sessionSummary(session) {
return { return {
@@ -65,7 +66,7 @@ export const getSessionById = asyncHandler(async (req, res) => {
export const getOrCreateSession = asyncHandler(async (req, res) => { export const getOrCreateSession = asyncHandler(async (req, res) => {
const { questId } = matchedData(req) const { questId } = matchedData(req)
if (await isQuestUnlocked(req.user, questId)) { if ((await isQuestUnlocked(req.user, questId)) || config.testing.enable) {
const session = await getOrCreateActiveSession(req.user, questId) const session = await getOrCreateActiveSession(req.user, questId)
res.json(sessionDetail(session)) res.json(sessionDetail(session))
} else { } else {