Skip to content

Commit e8d7a52

Browse files
author
Theresa
committed
Merge branch 'master' of github.com:openHPI/codeocean-classroom
2 parents c61fd69 + f836979 commit e8d7a52

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

app/controllers/exercises_controller.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,19 @@ def new
2828
end
2929

3030
def duplicate
31-
@exercise = Exercise.new(Exercise.find(params[:id]).attributes)
31+
exercise = Exercise.find(params[:id])
32+
@exercise = Exercise.new
33+
@exercise.title = exercise.title
34+
@exercise.public = exercise.public
35+
exercise.descriptions.each do |d|
36+
@exercise.descriptions << Description.new(d.attributes)
37+
end
38+
exercise.tests.each do |t|
39+
@exercise.tests << Test.new(t.attributes)
40+
end
41+
exercise.exercise_files.each do |f|
42+
@exercise.exercise_files << ExerciseFile.new(f.attributes)
43+
end
3244
render 'new'
3345
end
3446

app/views/carts/index.html.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<p id="notice"><%= notice %></p>
2-
31
<h2>Your Cart </h2>
42

53

app/views/carts/show.html.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<p id="notice"><%= notice %></p>
2-
31
<p>
42
<strong>Exercise:</strong>
53
<%= @cart.exercises %>

app/views/collections/index.html.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<p id="notice"><%= notice %></p>
2-
31
<h2>Your Collections <%= link_to 'New Collection', new_collection_path, class:'btn btn-success' %> </h2>
42

53
<table class="table">

app/views/collections/show.html.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<p id="notice"><%= notice %></p>
2-
31
<p>
42
<strong>Collection:</strong>
53
<%= @collection.title %>

0 commit comments

Comments
 (0)