Fixed SQL query on dashboard

It did not work properly before on Postgres
Contacts last_login column should be nullable
Merge pull request #188 from Lykegenes/master

Fixed SQL query on dashboard