forked from otwcode/otwarchive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 2310 - reading major_version_read can be nil, which causes erro…
…r 500 on the user's reading page This is a bit of a hot fix, but reading the code, major_version_read should never be nil, so it doesn't seem to make sense to add a special if case for nil. Only checking if it's different than the work's major version seems sufficient - the work's major_version will only go up, not down, so the reading's major version can either be the same, or lower. Or nil.
- Loading branch information
1 parent
5af6217
commit c3d85d6
Showing
1 changed file
with
18 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
<!--REVIEW: IS THIS AN INDEX, LISTBOX, or MODULE?--> | ||
<div class="history module group"> | ||
<% if reading.work.nil? %> | ||
<h3 class="heading"><%= t('.deleted_work', :default => '(deleted work, last viewed %{date})', :date => set_format_for_date(reading.last_viewed)) %></h3> | ||
<h3 class="heading"><%= ts("(deleted work, last viewed %{date})", :date => set_format_for_date(reading.last_viewed)) %></h3> | ||
<% else %> | ||
<ul><%= render :partial => 'works/work_blurb', :locals => {:work => | ||
reading.work} %></ul> | ||
<ul><%= render 'works/work_blurb', :work => reading.work %></ul> | ||
<h3 class="heading"> | ||
<span><%= ts("Last viewed:") %></span> <%= set_format_for_date(reading.last_viewed) %> | ||
<% if reading.major_version_read < reading.work.major_version %> | ||
<%= t('.new_version_available', :default => '(Update available.)') %> | ||
<% elsif reading.minor_version_read != reading.work.minor_version %> | ||
<%= t('.minor_edits', :default => '(Minor edits made since then.)') %> | ||
<% else %> | ||
<%= t('.most_recent_version', :default => '(Latest version.)') %> | ||
<% end %> | ||
<% if reading.view_count == 1 %> | ||
<%= ts("Viewed once")%> | ||
<% else %> | ||
<%= ts('Viewed %{count} times', :count => reading.view_count) %> | ||
<% end %> | ||
<% if reading.toread? %><%= t('to_read', :default => '(Flagged to read later.)') %><% end %> | ||
<% if reading.toskip? %><%= t('to_skip', :default => '(Flagged to skip.)') %><% end %> | ||
<span><%= ts("Last viewed:") %></span> <%= set_format_for_date(reading.last_viewed) %> | ||
<% if reading.major_version_read != reading.work.major_version %> | ||
<%= ts('(Update available.)') %> | ||
<% elsif reading.minor_version_read != reading.work.minor_version %> | ||
<%= ts('(Minor edits made since then.)') %> | ||
<% else %> | ||
<%= ts('(Latest version.)') %> | ||
<% end %> | ||
<% if reading.view_count == 1 %> | ||
<%= ts("Viewed once")%> | ||
<% else %> | ||
<%= ts("Viewed %{count} times", :count => reading.view_count) %> | ||
<% end %> | ||
<% if reading.toread? %><%= ts('(Flagged to read later.)') %><% end %> | ||
<% if reading.toskip? %><%= ts('(Flagged to skip.)') %><% end %> | ||
</h3> | ||
<% end %> | ||
<!-- actions --> | ||
<ul class="navigation actions" role="menu"> | ||
<li><%= link_to t('.links.delete', :default => "Delete"), user_reading_path(current_user, reading), :confirm => t('.links.are_you_sure', :default => 'Are you sure?'), :method => :delete %></li> | ||
<li><%= link_to ts("Delete"), user_reading_path(current_user, reading), :confirm => ts('Are you sure?'), :method => :delete %></li> | ||
</ul> | ||
</div> | ||
|