Skip to content

Commit 6f325c3

Browse files
committed
Don't talk about soft deadlines in exercise description if the course doesn't have them
1 parent dcccac5 commit 6f325c3

File tree

1 file changed

+51
-18
lines changed

1 file changed

+51
-18
lines changed

app/views/exercises/show.html.erb

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,61 @@
5757
<% end %>
5858
<% end %>
5959

60-
<% if @exercise.soft_deadline_for(current_user) %>
61-
<li>
62-
Deadline: <%= @exercise.soft_deadline_for(current_user) %>
63-
<% if @exercise.soft_deadline_spec_obj.universal_description %>
64-
(<%= @exercise.soft_deadline_spec_obj.universal_description %>)
60+
<% if @exercise.soft_deadline_for(current_user) && @exercise.deadline_for(current_user) %>
61+
<li>
62+
Deadline:
63+
<% if @exercise.soft_deadline_spec_obj.universal_description %>
64+
<%= @exercise.soft_deadline_spec_obj.universal_description %>
65+
<% else %>
66+
<%= @exercise.soft_deadline_for(current_user) %>
67+
<% end %>
68+
<% if Exercise.deadline_expired?(@exercise.soft_deadline_for(current_user)) %>
69+
<% if current_user.administrator? %>
70+
(expired (if you weren't an admin))
71+
<% else %>
72+
(expired)
6573
<% end %>
66-
<% if Exercise.deadline_expired?(@exercise.soft_deadline_for(current_user)) %>
67-
<% if current_user.administrator? %>
68-
(expired (if you weren't an admin))
69-
<% else %>
70-
(expired)
71-
<% end %>
74+
<% end %>
75+
<br>After the deadline has passed, you can still return the exercise until
76+
<% if @exercise.deadline_spec_obj.universal_description %>
77+
<%= @exercise.deadline_spec_obj.universal_description %>
78+
<% else %>
79+
<%= @exercise.deadline_for(current_user) %>
80+
<% end %>
81+
<% if Exercise.deadline_expired?(@exercise.deadline_for(current_user)) %>
82+
<% if current_user.administrator? %>
83+
(expired (if you weren't an admin))
84+
<% else %>
85+
(expired)
7286
<% end %>
73-
</li>
74-
<% end %>
75-
76-
<% if @exercise.deadline_for(current_user) %>
87+
<% end %>
88+
<br>However, you will only get <%= @course.soft_deadline_point_multiplier * 100 %>% of the points.
89+
</li>
90+
<% elsif @exercise.soft_deadline_for(current_user) %>
91+
<li>
92+
Deadline:
93+
<% if @exercise.soft_deadline_spec_obj.universal_description %>
94+
<%= @exercise.soft_deadline_spec_obj.universal_description %>
95+
<% else %>
96+
<%= @exercise.soft_deadline_for(current_user) %>
97+
<% end %>
98+
<% if Exercise.deadline_expired?(@exercise.soft_deadline_for(current_user)) %>
99+
<% if current_user.administrator? %>
100+
(expired (if you weren't an admin))
101+
<% else %>
102+
(expired)
103+
<% end %>
104+
<% end %>
105+
<br>After the deadline has passed, you can still return the exercise.
106+
<br>However, you will only get <%= @course.soft_deadline_point_multiplier * 100 %>% of the points.
107+
</li>
108+
<% elsif @exercise.deadline_for(current_user) %>
77109
<li>
78-
After the deadline has passed, you can still return the exercise until <%= @exercise.deadline_for(current_user) %>
110+
Deadline:
79111
<% if @exercise.deadline_spec_obj.universal_description %>
80-
(<%= @exercise.deadline_spec_obj.universal_description %>)
112+
<%= @exercise.deadline_spec_obj.universal_description %>
113+
<% else %>
114+
<%= @exercise.deadline_for(current_user) %>
81115
<% end %>
82116
<% if Exercise.deadline_expired?(@exercise.deadline_for(current_user)) %>
83117
<% if current_user.administrator? %>
@@ -86,7 +120,6 @@
86120
(expired)
87121
<% end %>
88122
<% end %>
89-
<br>However, you will only get <%= @course.soft_deadline_point_multiplier * 100 %>% of the points.
90123
</li>
91124
<% end %>
92125

0 commit comments

Comments
 (0)