summaryrefslogtreecommitdiff
path: root/help/app/models/ticket.rb
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-12-19 11:13:50 -0800
committerjessib <jessib@leap.se>2012-12-19 11:13:50 -0800
commitd6c881294880a934424e4d399786561d5c107167 (patch)
tree112f11efa255032127a92ee67af55f85ee5e8b62 /help/app/models/ticket.rb
parentaf5fc4b6b89583d81d5e495cd778d7e3b41dc828 (diff)
Some cleanup of code
Diffstat (limited to 'help/app/models/ticket.rb')
-rw-r--r--help/app/models/ticket.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb
index 7192cb3..fa056b4 100644
--- a/help/app/models/ticket.rb
+++ b/help/app/models/ticket.rb
@@ -141,25 +141,13 @@ class Ticket < CouchRest::Model::Base
def self.for_user(user, options = {}, is_admin = false)
- # TODO: This is obviously super tedious. we will refactor later.
# TODO: thought i should reverse keys for descending, but that didn't work. look into whether that should be tweaked, and whether it works okay with pagination (seems to now...)
- # TODO: Time.now + 2.days is to catch tickets created in future. shouldn't happen but does on my computer now, so this at least catches for now.
- # TODO handle default values correctly:
- options[:open_status] = 'open' if !options[:open_status] #hacky. redo this when handling defaults correctly
- options[:sort_order] = 'updated_at_desc' if !options[:sort_order] #hacky. redo this when handling defaults correctly
options[:user_id] = user.id
options[:is_admin] = is_admin
@selection = TicketSelection.new(options)
-
- #TODO: can this be more succinct?
- if @selection.order
- @tickets = Ticket.send(@selection.finder_method).startkey(@selection.startkey).endkey(@selection.endkey).send(@selection.order)
- else
- @tickets = Ticket.send(@selection.finder_method).startkey(@selection.startkey).endkey(@selection.endkey)
- end
-
+ @selection.tickets
end
#def self.tickets_by_commenter(user_id)#, options = {})