<commit_before>from django.views.generic.list_detail import object_list, object_detail
from django.views.generic.simple import direct_to_template
from django.contrib.auth.decorators import permission_required
from django.db.models import Max
from django.shortcuts import redirect
import models
from forms import CreateGameForm, additional_forms


def game_list(request, state=None, template_object_name='game', **kwargs):
    qs = models.Game.objects.select_related('turn').annotate(
        generated=Max('turn__generated')).order_by('-generated')
    if state is None:
        state = request.GET.get('state', None)
    if state is not None:
        qs = qs.filter(state=state)
    return object_list(request, qs, template_object_name=template_object_name,
                       **kwargs)
<commit_msg>Added the creation time as a fallback to the order_by for the game_list view.<commit_after>from django.views.generic.list_detail import object_list, object_detail
from django.views.generic.simple import direct_to_template
from django.contrib.auth.decorators import permission_required
from django.db.models import Max
from django.shortcuts import redirect
import models
from forms import CreateGameForm, additional_forms


def game_list(request, state=None, template_object_name='game', **kwargs):
    qs = models.Game.objects.select_related('turn').annotate(
        generated=Max('turn__generated')).order_by('-generated', '-created')
    if state is None:
        state = request.GET.get('state', None)
    if state is not None:
        qs = qs.filter(state=state)
    return object_list(request, qs, template_object_name=template_object_name,
                       **kwargs)

{'fraction_non_alphanumeric': 0.09085510688836104, 'fraction_numerical': 0.0, 'mean_word_length': 4.524590163934426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3346962', 'n_tokens_mistral': 468, 'n_tokens_neox': 459, 'n_words': 124}