summaryrefslogtreecommitdiff
path: root/help/app/models
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-27 13:01:57 +0100
committerAzul <azul@leap.se>2012-11-27 13:01:57 +0100
commit15d13d9abb9165b23369ea91d58505ca98d48b31 (patch)
treef3084615547baae0bb485c7f0d602b5e16d59da5 /help/app/models
parentebf5dddc39f09bac6640084edbaaefa9c9d48477 (diff)
first attempts to map comments
Diffstat (limited to 'help/app/models')
-rw-r--r--help/app/models/ticket.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb
index bc6ea59..81cd08e 100644
--- a/help/app/models/ticket.rb
+++ b/help/app/models/ticket.rb
@@ -48,6 +48,7 @@ class Ticket < CouchRest::Model::Base
emit(doc._id, doc);
}"
view :by_is_open_and_created_by
+ view :by_is_open_and_created_at
view :by_updated_at_and_is_open,
:map =>
"function(doc) {
@@ -62,6 +63,21 @@ class Ticket < CouchRest::Model::Base
emit(doc.updated_at, doc);
}
}"
+ view :by_commented_by,
+ :map =>
+ "function(doc) {
+ doc.comments.forEach(function(comment){
+ emit(comment.posted_by, doc);
+ });
+ }"
+
+ view :by_commented_by_and_commented_at,
+ :map =>
+ "function(doc) {
+ doc.comments.forEach(function(comment){
+ emit([comment.posted_by, comment.posted_at], doc);
+ });
+ }"
end