Minor optimization: get criterion_result only if needed in status_chooser (#835)
Minor optimization: get criterion_result only if needed in status_chooser (#835)

Partial view status_chooser is the largest consumer of time and memory
as reported by the "Scout" performance monitor.  This makes sense because
it is repeatedly called many times in a loop in project#show and
project#edit.

A minor but easy optimization is to delay calculation of value
criterion_result, so that we only calculate it when we need it
(we don't need it if we're retrieving a cached value).
This doesn't help that much, but it does no harm and from a logical
viewpoint it makes sense to calculate it around the first location of use.

Signed-off-by: David A. Wheeler <9ae72d22d8b894b865a7a496af4fab6320e6abb2@dwheeler.com>
taylorcoursey/cii-best-practices-badge,linuxfoundation/cii-best-practices-badge,taylorcoursey/cii-best-practices-badge,linuxfoundation/cii-best-practices-badge,coreinfrastructure/best-practices-badge,yannickmoy/cii-best-practices-badge,taylorcoursey/cii-best-practices-badge,coreinfrastructure/best-practices-badge,yannickmoy/cii-best-practices-badge,taylorcoursey/cii-best-practices-badge,linuxfoundation/cii-best-practices-badge,linuxfoundation/cii-best-practices-badge,coreinfrastructure/best-practices-badge,coreinfrastructure/best-practices-badge,yannickmoy/cii-best-practices-badge,yannickmoy/cii-best-practices-badge