Skip to content

Commit

Permalink
Merge pull request #5272 from dodona-edu/fix/labels-disappear
Browse files Browse the repository at this point in the history
Fix user label disappearing on global feedback update
  • Loading branch information
jorg-vr authored Jan 9, 2024
2 parents 800b006 + e3a155b commit d4bfbf2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
7 changes: 0 additions & 7 deletions app/controllers/feedbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ def show
]
@title = I18n.t('feedbacks.show.feedback')

@user_labels = @feedback.evaluation
.series
.course
.course_memberships
.find_by(user_id: @feedback.user)
.course_labels

@score_map = @feedback.scores.index_by(&:score_item_id)
# If we refresh all scores because of a conflict, we want to make
# sure the user is aware the update was not successful. By setting
Expand Down
9 changes: 9 additions & 0 deletions app/models/feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ def maximum_score
mapped.sum if mapped.any?
end

def user_labels
evaluation
.series
.course
.course_memberships
.find_by(user_id: user)
.course_labels
end

private

def determine_submission
Expand Down
8 changes: 4 additions & 4 deletions app/views/feedbacks/_feedback_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@
</div>
<div class="username-row">
<h4 class="ellipsis-overflow name" title="<%= @feedback.user.full_name %>"><%= @feedback.user.full_name %></h4>
<% if @user_labels.present? %>
<span class="token accent-orange" title="<%= @user_labels.first.name %>"><%= @user_labels.first.name %></span>
<% if @feedback.user_labels.present? %>
<span class="token accent-orange" title="<%= @feedback.user_labels.first.name %>"><%= @feedback.user_labels.first.name %></span>
<% end %>
</div>
<% if @user_labels.present? && @user_labels.length > 1 %>
<% if @feedback.user_labels.present? && @feedback.user_labels.length > 1 %>
<div class="labels-row">
<% @user_labels[1..].each do |label| %>
<% @feedback.user_labels[1..].each do |label| %>
<span class="token accent-orange" title="<%= label.name %>"><%= label.name %></span>
<% end %>
</div>
Expand Down

0 comments on commit d4bfbf2

Please sign in to comment.