Put outcome in database also when dealing with user tests.

Closes #255.
Fixup.
Add a hidden setting to write DEBUG messages in the file log.
Fix a race issue in search_jobs_not_done().

Prevent job_busy() from being run concurrently with action_finished(),
which modifies the data queried by job_busy() and temporarily leaves
them in an inconsistent state. In such a case, push_in_queue() is
tricked into mistakenly adding again to the queue a job that has
already been processed.

Closes #254.
Fix another race issue in search_jobs_not_done().

The previous commit is not enough, since it may happen that
action_finished() is run on a job between when to_compile() and
job_busy() are called on it.  This would trick push_in_queue() to
mistakenly queue again the job.

In practice, I couldn't observe this behavior. I think that the
timings in the calls make it impossible or very improbable that this
scenario happen.  Anyway, this commit should fix the error and
completely close #254.

What happens with this commit is that in push_in_queue() the job is
tested again with to_compile() (or similar calls), in a new SQLAlchemy
session the lives entirely inside the post_finish_lock. This way
possible concurrent executions with action_finished() are prevented.
Fixed some type annotations and reformatted some pydocs.
Update pydoc to allow None were we pass None.
Minor.
Move contest phase computation out of render_params
Add tests for phase computation and fix a few minor bugs

The bugs were:
- when in a post-contest phase, the start of that phase was computed
  without taking the extra_time into account;
- the starting_time was allowed to be before the start of the contest;
- when starting_time was not None we assumed it to be in the past, i.e.
  starting_time <= timestamp.
These were all conditions that didn't affect a "normal" contest.
Rewrite the phase computation function

Simplify it and support delay_time (reenabling its tests).
Add delay_time
Minor for pydoc types.
Update pot generation command.
Complete ja, it, fr, nl, ru translations and fix a string.

Thanks to all translators.

There was a typo "infinite an infinite number..." I just keeped the
translations as they are very likely to be correct.

I also removed the location info in all translations (as we started
doing a while ago) and old strings not useful anymore.
Completed lt translation.

Thanks to Vytis Banaitis.
Added competitions in README and missing bs translations.
Add CEOI 2014 to testimonals.

Also fix some punctuation.
Stop services giving the same ID to all their sandboxes

This helps in case of task that require multiple sandboxes (like those
of Communication type) to reduce mutual interferences.
Doc about task versioning.