Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ece6c71

Browse files
committed
fix(case): question not found
1 parent 763702e commit ece6c71

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lua/leetcode-ui/group/case.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ end
5555
---@param passed boolean
5656
---
5757
---@return lc.ui.Case
58-
function Case:init(body, passed)
58+
function Case:init(body, passed, question)
5959
Case.super.init(self, {}, { spacing = 1 })
6060

6161
self.body = body
62-
self.question = utils.curr_question()
62+
self.question = question
6363

6464
self:insert(self:input(body.input))
6565
self:insert(self:output(body.output, body.expected))
@@ -71,7 +71,7 @@ function Case:init(body, passed)
7171
self.passed = passed
7272
end
7373

74-
---@alias lc.Result.Case.constructor fun(body: case_body, passed: boolean): lc.ui.Case
74+
---@alias lc.Result.Case.constructor fun(body: case_body, passed: boolean, question: lc.ui.Question): lc.ui.Case
7575
---@type lc.Result.Case.constructor
7676
local LeetCase = Case
7777

lua/leetcode-ui/group/cases.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function Cases:init(item, parent)
6767
output = item.code_answer[i],
6868
expected = item.expected_code_answer[i],
6969
std_output = item.std_output_list[i],
70-
}, item.compare_result:sub(i, i) == "1")
70+
}, item.compare_result:sub(i, i) == "1", parent.question)
7171
end
7272

7373
self:change(1)

lua/leetcode-ui/renderer/result.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function ResultLayout:handle_submission_error(item) -- status code = 11
130130
output = item.code_output,
131131
expected = item.expected_output,
132132
std_output = item.std_output,
133-
}, false))
133+
}, false, self.parent.question))
134134
end
135135

136136
---@private

0 commit comments

Comments
 (0)