mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: track statistics around post creation
- how long were people typing? - how long was composer open? - how many drafts were created? - correct, draft saved to go away after you continue typing store in Post.find(xyz).post_stat
This commit is contained in:
@@ -7,7 +7,11 @@ class Draft < ActiveRecord::Base
|
||||
d = find_draft(user,key)
|
||||
if d
|
||||
return if d.sequence > sequence
|
||||
d.update_columns(data: data, sequence: sequence)
|
||||
exec_sql("UPDATE drafts
|
||||
SET data = :data,
|
||||
sequence = :sequence,
|
||||
revisions = revisions + 1
|
||||
WHERE id = :id", id: d.id, sequence: sequence, data: data)
|
||||
else
|
||||
Draft.create!(user_id: user.id, draft_key: key, data: data, sequence: sequence)
|
||||
end
|
||||
|
||||
@@ -37,6 +37,7 @@ class Post < ActiveRecord::Base
|
||||
has_many :uploads, through: :post_uploads
|
||||
|
||||
has_one :post_search_data
|
||||
has_one :post_stat
|
||||
|
||||
has_many :post_details
|
||||
|
||||
|
||||
3
app/models/post_stat.rb
Normal file
3
app/models/post_stat.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class PostStat < ActiveRecord::Base
|
||||
belongs_to :post
|
||||
end
|
||||
Reference in New Issue
Block a user