Skip to content

Commit 4d552ae

Browse files
improve bad queries (#92)
* improve doc insert perf * remove bad query * time
1 parent 63e8e94 commit 4d552ae

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

app/views/layouts/application.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,11 @@
137137
AI Generated Answers From <b>Your</b> Documentation
138138
</div>
139139
<div class="text-left">
140-
<% cache "footer", expires_in: 60.seconds do %>
140+
<% cache "footer", expires_in: 1.hours do %>
141141
<span class="text-xs text-stone-300">LAST 7 DAYS</span>
142142
<div class="text-sky-300 text-sm ">
143143
<%= Question.all.where("created_at >= ?", 7.days.ago).count %> <span class="font-light text-stone-400"> questions</span>
144144
</div>
145-
<div class="text-sky-300 text-sm ">
146-
<%= Question.all.where("created_at >= ?", 7.days.ago).map(&:get_upvotes).sum(&:size) %> <span class="font-light text-stone-400"> helpful answers</span>
147-
</div>
148145
<div class="text-sky-300 text-sm ">
149146
<%= Document.all.where("updated_at >= ?", 7.days.ago).count %> <span class="font-light text-stone-400"> updated documents</span>
150147
</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddIndexToDocument < ActiveRecord::Migration[7.1]
2+
def change
3+
add_index :documents, :check_hash
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)