lib/yinx_st.rb in yinx_st-0.1.2 vs lib/yinx_st.rb in yinx_st-0.1.3
- old
+ new
@@ -13,11 +13,11 @@
Yinx::SQL.connect(*args)
self
end
def last_n_days n
- batches = Batches.new n
+ batches = Batches.new(n + 1)
duration = "最近#{n}日"
@chart = MyChart.js do
material batches.all_notes
material batches.unwind_tags, name: :unwind_tags
@@ -29,11 +29,11 @@
select :yesterday, from: :unwind_tags do |note|
note.dump_id == batches.latest_id
end
select :changed_content do |note|
- note.status == :created or note.status == :updated
+ note.status != :remained
end
select :moved_book do |note|
note.moved_book?
end
@@ -51,23 +51,23 @@
group_by :number_of_tags do |note|
note.tags.count
end
- plainBar :dump_day, name: "#{duration}总数变化", w: 1000, h:240, asc: :key
- line :dump_day, :status, name: "#{duration}新建/修改", from: :changed_content, w: 1000, h:240, asc: :key, keys: batches.time_line
- line :dump_day, name: "#{duration}移动笔记本", from: :moved_book, w: 1000, h:240, asc: :key, keys: batches.time_line
- line :dump_day, name: "#{duration}更改标签", from: :changed_tags, w: 1000, h:240, asc: :key, keys: batches.time_line
+ plainBar :dump_day, name: "#{duration}总数变化", w: 1000, h:240, asc: :key, last: n
+ line :dump_day, :status, name: "#{duration}新建/修改/删除", from: :changed_content, w: 1000, h:240, asc: :key, keys: batches.time_line, last: n
+ line :dump_day, name: "#{duration}移动笔记本", from: :moved_book, w: 1000, h:240, asc: :key, keys: batches.time_line, last: n
+ line :dump_day, name: "#{duration}更改标签", from: :changed_tags, w: 1000, h:240, asc: :key, keys: batches.time_line, last: n
bar :stack_book, name: '目前最大的10个笔记本', from: :yesterday, w:1400 ,h: 540, desc: :count, first: 10
- line :dump_day, :stack_book, name: "#{duration}笔记本体积变化", w: 1200, h:540, asc: :key, keys: batches.time_line
+ line :dump_day, :stack_book, name: "#{duration}笔记本体积变化", w: 1200, h:540, asc: :key, keys: batches.time_line, last: n
bar :stack, name: '目前最大的10个笔记本组', from: :yesterday, w:1400 ,h: 240, desc: :count, first: 10
- line :dump_day, :stack, name: "#{duration}笔记本组体积变化", w: 1000, h:340, asc: :key, keys: batches.time_line
+ line :dump_day, :stack, name: "#{duration}笔记本组体积变化", w: 1000, h:340, asc: :key, keys: batches.time_line, last: n
pie :tags, name: '目前使用最多的15个标签', from: :yesterday__from__unwind_tags, w:1400 ,h: 340, desc: :count, first: 15
bar :number_of_tags, name: '目前每篇笔记的标签数', from: :yesterday, w: 800, h: 240, asc: :key
- line :dump_day, :tags, name: "#{duration}标签数变化", from: :unwind_tags, w: 1400, h:740, asc: :key, keys: batches.time_line
+ line :dump_day, :tags, name: "#{duration}标签数变化", from: :unwind_tags, w: 1400, h:740, asc: :key, keys: batches.time_line, last: n
end
self
end