Defect #36248 » 36248.patch
| app/models/time_entry_query.rb | ||
|---|---|---|
| 88 | 88 |
activities = (project ? project.activities : TimeEntryActivity.shared) |
| 89 | 89 |
add_available_filter( |
| 90 | 90 |
"activity_id", |
| 91 |
:type => :list, :values => activities.map {|a| [a.name, a.id.to_s]}
|
|
| 91 |
:type => :list, :values => activities.map {|a| [a.name, (a.parent_id || a.id).to_s]}
|
|
| 92 | 92 |
) |
| 93 | 93 |
add_available_filter( |
| 94 | 94 |
"project.status", |
| test/functional/queries_controller_test.rb | ||
|---|---|---|
| 917 | 917 |
assert_include ['Dave2 Lopper2', '5', 'locked'], json |
| 918 | 918 |
assert_include ['A Team', '10', 'active'], json |
| 919 | 919 |
end |
| 920 | ||
| 921 |
def test_activity_filter_should_return_active_and_system_activity_ids |
|
| 922 |
TimeEntryActivity.create!(:name => 'Design', :parent_id => 9, :project_id => 1) |
|
| 923 |
TimeEntryActivity.create!(:name => 'QA', :active => false, :parent_id => 11, :project_id => 1) |
|
| 924 |
TimeEntryActivity.create!(:name => 'Inactive Activity', :active => true, :parent_id => 14, :project_id => 1) |
|
| 925 | ||
| 926 |
@request.session[:user_id] = 2 |
|
| 927 |
get( |
|
| 928 |
:filter, |
|
| 929 |
:params => {
|
|
| 930 |
:project_id => 1, |
|
| 931 |
:type => 'TimeEntryQuery', |
|
| 932 |
:name => 'activity_id' |
|
| 933 |
} |
|
| 934 |
) |
|
| 935 |
assert_response :success |
|
| 936 |
assert_equal 'application/json', response.media_type |
|
| 937 |
json = ActiveSupport::JSON.decode(response.body) |
|
| 938 | ||
| 939 |
assert_equal 3, json.count |
|
| 940 |
assert_include ["Design", "9"], json |
|
| 941 |
assert_include ["Development", "10"], json |
|
| 942 |
assert_include ["Inactive Activity", "14"], json |
|
| 943 |
end |
|
| 920 | 944 |
end |
- « Previous
- 1
- 2
- 3
- 4
- Next »