@@ -52,21 +52,6 class TimeEntry < ActiveRecord::Base | |||||
52 | joins(:issue). |
|
52 | joins(:issue). | |
53 | where("#{Issue.table_name}.root_id = #{issue.root_id} AND #{Issue.table_name}.lft >= #{issue.lft} AND #{Issue.table_name}.rgt <= #{issue.rgt}") |
|
53 | where("#{Issue.table_name}.root_id = #{issue.root_id} AND #{Issue.table_name}.lft >= #{issue.lft} AND #{Issue.table_name}.rgt <= #{issue.rgt}") | |
54 | } |
|
54 | } | |
55 | scope :on_project, lambda {|project, include_subprojects| |
|
|||
56 | joins(:project). |
|
|||
57 | where(project.project_condition(include_subprojects)) |
|
|||
58 | } |
|
|||
59 | scope :spent_between, lambda {|from, to| |
|
|||
60 | if from && to |
|
|||
61 | where("#{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", from, to) |
|
|||
62 | elsif from |
|
|||
63 | where("#{TimeEntry.table_name}.spent_on >= ?", from) |
|
|||
64 | elsif to |
|
|||
65 | where("#{TimeEntry.table_name}.spent_on <= ?", to) |
|
|||
66 | else |
|
|||
67 | where(nil) |
|
|||
68 | end |
|
|||
69 | } |
|
|||
70 |
|
55 | |||
71 | safe_attributes 'hours', 'comments', 'project_id', 'issue_id', 'activity_id', 'spent_on', 'custom_field_values', 'custom_fields' |
|
56 | safe_attributes 'hours', 'comments', 'project_id', 'issue_id', 'activity_id', 'spent_on', 'custom_field_values', 'custom_fields' | |
72 |
|
57 |
General Comments 0
You need to be logged in to leave comments.
Login now