mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
fix: stage re-execute
This commit is contained in:
1 parent
d4446186cd
commit
c7d18ad95e
2 files changed
+7
-2
No files matched your search
@@ -122,7 +122,7 @@ export default class CommandHandler extends SessionHandler {
|
|||||||
async run() {
|
async run() {
|
||||||
try {
|
try {
|
||||||
this.quest = await Quest.findById(this.session.quest)
|
this.quest = await Quest.findById(this.session.quest)
|
||||||
const stages = this.getUnlockedComponents(this.quest.stages)
|
const stages = this.getStages()
|
||||||
if (stages.length === 0) {
|
if (stages.length === 0) {
|
||||||
logger.warn('stage not found', { session: this.session.id })
|
logger.warn('stage not found', { session: this.session.id })
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -25,8 +25,13 @@ export default class SessionHandler {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStages() {
|
||||||
|
const unlockedStages = this.getUnlockedComponents(this.quest.stages)
|
||||||
|
return unlockedStages.filter((s) => !this.isCompleted(s))
|
||||||
|
}
|
||||||
|
|
||||||
getNewTasks() {
|
getNewTasks() {
|
||||||
const stages = this.getUnlockedComponents(this.quest.stages)
|
const stages = this.getStages()
|
||||||
return stages
|
return stages
|
||||||
.filter((s) => s.task)
|
.filter((s) => s.task)
|
||||||
.filter((s) => !this.session.tasks.some((t) => t.id === s.id))
|
.filter((s) => !this.session.tasks.some((t) => t.id === s.id))
|
||||||
|
|||||||
Reference in new issue
Block a user