<commit_before>from django.http import HttpResponseNotFound
from django.shortcuts import render
from batch_apps.models import App, Execution
from batch_apps.generator import *
import datetime


def index(request):

    date_ = datetime.date(2014, 10, 20)
    day_object = get_or_create_day_object(date_)

    active_apps = App.objects.filter(is_active=True)
    get_or_create_execution_objects(day_object, active_apps)

    executions_list = Execution.objects.filter(day__date=date_)

    context = {'date': date_, 'executions_list': executions_list}
    return render(request, 'executions.html', context)


def specific_date(request, yyyy_mm_dd):

    today = get_current_date_in_gmt8()
    date_ = datetime.datetime.strptime(yyyy_mm_dd, "%Y-%m-%d").date()

    if date_ > today:
        return HttpResponseNotFound("<h1>Page not found - Can not show date more than today</h1>")

    else:
        day_object = get_or_create_day_object(date_)

        active_apps = App.objects.filter(is_active=True)
        get_or_create_execution_objects(day_object, active_apps)

        executions_list = Execution.objects.filter(day__date=date_)
<commit_msg>refactored index view to reuse specific view module using current date<commit_after>from django.http import HttpResponseNotFound
from django.shortcuts import render
from batch_apps.models import App, Execution
from batch_apps.generator import *
import datetime


def index(request):

    today = get_current_date_in_gmt8().strftime("%Y-%m-%d")
    return specific_date(request, today)


def specific_date(request, yyyy_mm_dd):

    today = get_current_date_in_gmt8()
    date_ = datetime.datetime.strptime(yyyy_mm_dd, "%Y-%m-%d").date()

    if date_ > today:
        return HttpResponseNotFound("<h1>Page not found - Can not show date more than today</h1>")

    else:
        day_object = get_or_create_day_object(date_)

        active_apps = App.objects.filter(is_active=True)
        get_or_create_execution_objects(day_object, active_apps)

        executions_list = Execution.objects.filter(day__date=date_)

{'fraction_non_alphanumeric': 0.09161415414444983, 'fraction_numerical': 0.007270964614638876, 'mean_word_length': 4.563342318059299, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6844065', 'n_tokens_mistral': 670, 'n_tokens_neox': 636, 'n_words': 138}