Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduling_poll#show raise an error if db is sqlite #43

Closed
cat-in-136 opened this issue Jun 23, 2019 · 0 comments
Closed

scheduling_poll#show raise an error if db is sqlite #43

cat-in-136 opened this issue Jun 23, 2019 · 0 comments
Labels

Comments

@cat-in-136
Copy link
Owner

cat-in-136 commented Jun 23, 2019

SQLite does not a native datetime type. COALESCE function call returns a string not datetime.

<% ((@poll.votes.group(:user).maximum("COALESCE(scheduling_votes.updated_at, scheduling_votes.created_at)").to_a) +
    (@poll.scheduling_poll_items.map{|v| [v, v.updated_at || v.created_at]} )).reject{|v| v[1].nil? }.sort{|a,b| a[1] <=> b[1]}.each do |v| %>
  <% subject, datetime = v %>
  <% if subject.kind_of? User
     user = subject %>
    <li>
      <%= avatar(user, :size => "24") %>
      <%= authoring datetime, user, :label => :label_updated_time_by %>
    </li>
  <% elsif subject.kind_of? SchedulingPollItem %>
    <li class="scheduling-poll-item-update">
      <%= l(:label_scheduling_poll_item) %> "<%=h subject.text %>":
      <%= l(:label_updated_time, :value => time_tag(datetime)).html_safe %>
    </li>
  <% end %>
<% end %>

authoring function 1st argument should be an DateTimeTimeZone but actual is a String if the DB is sqlite. In which case, an error raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant