Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

users not checked if nil #6

Closed
cforce opened this issue Feb 10, 2012 · 7 comments
Closed

users not checked if nil #6

cforce opened this issue Feb 10, 2012 · 7 comments

Comments

@cforce
Copy link
Contributor

cforce commented Feb 10, 2012

Processing PollsController#index (for 172.16.104.6 at 2012-02-10 17:34:58) [GET]
I, [2012-02-10T17:34:58.540528 #11109] INFO -- : Parameters: {"project_id"=>"spielwiese", "action"=>"index", "controller"=>"polls"}
D, [2012-02-10T17:34:58.542652 #11109] DEBUG -- : �[4;36;1mSQL (1.4ms)�[0m �[0;1mSELECT max(settings.updated_on) AS max_updated_on FROM settings �[0m
D, [2012-02-10T17:34:58.544404 #11109] DEBUG -- : �[4;35;1mUser Load (1.0ms)�[0m �[0mSELECT * FROM users WHERE (users.id = 3) AND (users.status = 1) AND ( (users.type = 'User' OR users.type = 'AnonymousUser' ) ) �[0m
D, [2012-02-10T17:34:58.545424 #11109] DEBUG -- : �[4;36;1mProject Load (0.3ms)�[0m �[0;1mSELECT * FROM projects WHERE (projects.identifier = 'spielwiese') LIMIT 1�[0m
D, [2012-02-10T17:34:58.546406 #11109] DEBUG -- : �[4;35;1mEnabledModule Load (0.5ms)�[0m �[0mSELECT name FROM enabled_modules WHERE (enabled_modules.project_id = 105) �[0m
D, [2012-02-10T17:34:58.559199 #11109] DEBUG -- : �[4;36;1mIssueStatus Load (6.4ms)�[0m �[0;1mSELECT * FROM issue_statuses ORDER BY position�[0m
D, [2012-02-10T17:34:58.560408 #11109] DEBUG -- : �[4;35;1mEligibleStatus Load (0.9ms)�[0m �[0mSELECT * FROM eligible_statuses �[0m
D, [2012-02-10T17:34:58.560745 #11109] DEBUG -- : �[4;36;1mCACHE (0.0ms)�[0m �[0;1mSELECT * FROM projects WHERE (projects.identifier = 'spielwiese') LIMIT 1�[0m
D, [2012-02-10T17:34:58.561148 #11109] DEBUG -- : �[4;35;1mCACHE (0.0ms)�[0m �[0mSELECT name FROM enabled_modules WHERE (enabled_modules.project_id = 105) �[0m
D, [2012-02-10T17:34:58.576189 #11109] DEBUG -- : �[4;36;1mVotingPoll Load (8.8ms)�[0m �[0;1mSELECT * FROM voting_polls WHERE (voting_polls.project_id = 105) �[0m
I, [2012-02-10T17:34:58.578292 #11109] INFO -- : Rendering template within layouts/base
I, [2012-02-10T17:34:58.578351 #11109] INFO -- : Rendering polls/index
D, [2012-02-10T17:34:58.584540 #11109] DEBUG -- : Rendered polls/_config (3.2ms)
F, [2012-02-10T17:34:58.614064 #11109] FATAL -- :
ActionView::TemplateError (undefined method `empty?' for nil:NilClass) on line #15 of vendor/plugins/redmine_issues_poll/app/views/polls/_members.rhtml:
12: See the License for the specific language governing permissions and
13: limitations under the License. -->
14:
15: <% if @users.empty? %>
16:


17: <%= l(:label_no_data) %>
18:

vendor/plugins/redmine_issues_poll/app/views/polls/_members.rhtml:15:in `_run_rhtml_vendor47plugins47redmine_issues_poll47app47views47polls47_members46rhtml_locals_members_object_tab'
app/views/common/_tabs.rhtml:24:in `_run_rhtml_app47views47common47_tabs46rhtml_locals_object_tabs'
app/views/common/_tabs.rhtml:23:in `each'
app/views/common/_tabs.rhtml:23:in `_run_rhtml_app47views47common47_tabs46rhtml_locals_object_tabs'
app/helpers/application_helper.rb:218:in `render_tabs'
vendor/plugins/redmine_issues_poll/app/views/polls/index.rhtml:21:in `_run_rhtml_vendor47plugins47redmine_issues_poll47app47views47polls47index46rhtml'
passenger (3.0.8) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.8) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.8) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.8) helper-scripts/passenger-spawn-server:99

I, [2012-02-10T17:34:58.629631 #11109] INFO -- : Rendering /opt/redmine-1.2.1d3/public/500.html (500 Internal Server Error)

@edmagne-zz
Copy link
Contributor

Is there a situation that "@users" is null?

edmagne-zz pushed a commit that referenced this issue Feb 11, 2012
@edmagne-zz
Copy link
Contributor

could you check?

@cforce
Copy link
Contributor Author

cforce commented Feb 14, 2012

I checked that the error is gone now, but why i don't see any users to set votes for?
The are users with roles with rights for voting, so there sould be a list also!

@cforce
Copy link
Contributor Author

cforce commented Feb 14, 2012

There are two queries executed

SELECT * FROM users WHERE (users.id = 3) AND (users.status = 1) AND ( (users.type = 'User' OR users.type = 'AnonymousUser' ) )

Above queries can only find me (logged in user) because of users.id` = 3

SELECT * FROM users INNER JOIN groups_users ON users.id = groups_users.group_id WHERE (groups_users.user_id = 3 ) AND ( (users.type = 'Group' ) )

Above qeury only finds group i (logged in user) belong to.

Where is a query that shall build the user list?

@edmagne-zz
Copy link
Contributor

1- In the list should display all project members.

2 - The query is from association between Project and User. "@project.users"

@cforce
Copy link
Contributor Author

cforce commented Feb 15, 2012

The queries must be wrong because users.id=3 can only be one user!
Where do you get this id and why? Its just one person. Dodn't you wanna find all members for a project that have role with right to vote? Therefore you must join projects, users, members, memeber_roles and roles table.
Where is this query?

The list is empty but there are mor than 30 members you can see in project overview and in projects settings too.
Maybe the cause is we use ldap for users security realm not internal user base? But ldap is stdandard redmine feature and the users are synced from ldap with all atributes to mysql user table

@edmagne-zz
Copy link
Contributor

This is the query:

@users = @project.users.collect {|user| {'id' => user.id, 'login' => user.login, 'fullname' => user.name(:firstname_lastname), 'votes' => user.polls_votes_project(@project.id)? user.polls_votes_project(@project.id) : '--'}}

edmagne-zz pushed a commit that referenced this issue Mar 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants