Contrib button improvements

Don't do that :-) Use SQL:

```SQL
 select count(id) as n_tasks from task where app_id=:app_id;
```
Then, in the code, replace from n_tasks:

```python
for r in result:
   n_tasks = r.n_tasks
return n_tasks  == 0
```