File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
app/controllers/api/v8/courses Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -46,18 +46,25 @@ def index
46
46
exercises . where ( unlock_spec : nil )
47
47
else
48
48
exercises . where ( [ "unlock_spec IS NULL OR name IN (#{ unlocked_exercises . map { |_ | '?' } . join ( ', ' ) } )" , *unlocked_exercises ] )
49
- end . select { | e | e . _fast_visible_to? ( current_user ) }
49
+ end
50
50
end
51
51
52
- presentable = exercises . map do |ex |
52
+ exercises = exercises . pluck ( :id )
53
+
54
+ all_exercises = course . exercises
55
+ . where ( hidden : false , disabled_status : 0 )
56
+ . select { |ex | ex . _fast_visible_to? ( current_user ) }
57
+
58
+ presentable = all_exercises . map do |ex |
53
59
{
54
60
id : ex . id ,
55
61
available_points : ex . available_points ,
56
62
name : ex . name ,
57
63
publish_time : ex . publish_time ,
58
64
solution_visible_after : ex . solution_visible_after ,
59
65
deadline : ex . deadline_for ( current_user ) ,
60
- disabled : ex . disabled?
66
+ disabled : ex . disabled? ,
67
+ unlocked : exercises . include? ( ex . id )
61
68
}
62
69
end
63
70
You can’t perform that action at this time.
0 commit comments