Fix access to CommunitySolution

This commit is contained in:
Sebastian Serth
2021-11-24 09:20:25 +01:00
parent 3572f5fbda
commit e5a4a1d48d

View File

@ -29,7 +29,8 @@ class CommunitySolutionsController < ApplicationController
if last_contribution.blank?
last_contribution = @community_solution.exercise
new_readme_file = {content: '', file_type: FileType.find_by(file_extension: '.txt'), hidden: false, read_only: false, name: 'ReadMe', role: 'regular_file', context: @community_solution}
@files << CodeOcean::File.create!(new_readme_file)
# If the first user did not save, the ReadMe file already exists
@files << CodeOcean::File.find_or_create_by!(new_readme_file)
end
all_visible_files = last_contribution.files.select(&:visible)
# Add the ReadMe file first