stages/prompt: fix fields not being sorted correctly
This commit is contained in:
parent
0fb17eee43
commit
05a5b5b675
|
@ -161,7 +161,7 @@ class PromptStageView(ChallengeStageView):
|
||||||
response_class = PromptResponseChallenge
|
response_class = PromptResponseChallenge
|
||||||
|
|
||||||
def get_challenge(self, *args, **kwargs) -> Challenge:
|
def get_challenge(self, *args, **kwargs) -> Challenge:
|
||||||
fields = list(self.executor.current_stage.fields.all())
|
fields = list(self.executor.current_stage.fields.all().order_by("order"))
|
||||||
challenge = PromptChallenge(
|
challenge = PromptChallenge(
|
||||||
data={
|
data={
|
||||||
"type": ChallengeTypes.native,
|
"type": ChallengeTypes.native,
|
||||||
|
@ -185,5 +185,4 @@ class PromptStageView(ChallengeStageView):
|
||||||
if PLAN_CONTEXT_PROMPT not in self.executor.plan.context:
|
if PLAN_CONTEXT_PROMPT not in self.executor.plan.context:
|
||||||
self.executor.plan.context[PLAN_CONTEXT_PROMPT] = {}
|
self.executor.plan.context[PLAN_CONTEXT_PROMPT] = {}
|
||||||
self.executor.plan.context[PLAN_CONTEXT_PROMPT].update(response.validated_data)
|
self.executor.plan.context[PLAN_CONTEXT_PROMPT].update(response.validated_data)
|
||||||
print(self.executor.plan.context[PLAN_CONTEXT_PROMPT])
|
|
||||||
return self.executor.stage_ok()
|
return self.executor.stage_ok()
|
||||||
|
|
Reference in New Issue