Fix sorting jobs by time_submitted and state

After joining with the tasks table multiple times, the state and
time_submitted columns become ambiguous, which makes sorting by them a
bit more involved.
Merge pull request #197 from guidow/job_index_sort_fix

Fix sorting jobs by time_submitted and state