The code following code could be extracted to a method on user model: 
```
.contributions.where(project_id: resource.project_id).with_states(['confirmed','waiting_confirmation']).empty?
```