# Copyright 2019 Matthias Ring
# Machine Learning and Data Analytics Lab
# Friedrich-Alexander-University Erlangen-Nuremberg
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from django.shortcuts import render

from assessment.models import EquidistantAssessment, OctopusG1Assessment


def index(request):
    context = {'program_type': None}
    program_type = request.GET.get('program_type', 'equidistant')

    if program_type == 'equidistant':
        assessments_left = EquidistantAssessment.objects.filter(user=request.user, tested_eye=0) \
                               .order_by('date').reverse()[:3]
        assessments_right = EquidistantAssessment.objects.filter(user=request.user, tested_eye=1) \
                                .order_by('date').reverse()[:3]

        context = {'left': assessments_left, 'right': assessments_right, 'program_type': program_type}

    elif program_type == 'octopusg1':
        assessments_left = OctopusG1Assessment.objects.filter(user=request.user, tested_eye=0) \
                               .order_by('date').reverse()[:3]
        assessments_right = OctopusG1Assessment.objects.filter(user=request.user, tested_eye=1) \
                                .order_by('date').reverse()[:3]

        context = {'left': assessments_left, 'right': assessments_right, 'program_type': program_type}

    return render(request, 'stats/index.html', context)

53b29174d4d3abd335c7126dca012085f051ccbf
<mask token>

<mask token>


def index(request):
    context = {'program_type': None}
    program_type = request.GET.get('program_type', 'equidistant')
    if program_type == 'equidistant':
        assessments_left = EquidistantAssessment.objects.filter(user=
            request.user, tested_eye=0).order_by('date').reverse()[:3]
        assessments_right = EquidistantAssessment.objects.filter(user=
            request.user, tested_eye=1).order_by('date').reverse()[:3]
        context = {'left': assessments_left, 'right': assessments_right,
            'program_type': program_type}
    elif program_type == 'octopusg1':
        assessments_left = OctopusG1Assessment.objects.filter(user=request.
            user, tested_eye=0).order_by('date').reverse()[:3]
        assessments_right = OctopusG1Assessment.objects.filter(user=request
            .user, tested_eye=1).order_by('date').reverse()[:3]
        context = {'left': assessments_left, 'right': assessments_right,
            'program_type': program_type}
    return render(request, 'stats/index.html', context)

from django.shortcuts import render
from assessment.models import EquidistantAssessment, OctopusG1Assessment


def index(request):
    context = {'program_type': None}
    program_type = request.GET.get('program_type', 'equidistant')
    if program_type == 'equidistant':
        assessments_left = EquidistantAssessment.objects.filter(user=
            request.user, tested_eye=0).order_by('date').reverse()[:3]
        assessments_right = EquidistantAssessment.objects.filter(user=
            request.user, tested_eye=1).order_by('date').reverse()[:3]
        context = {'left': assessments_left, 'right': assessments_right,
            'program_type': program_type}
    elif program_type == 'octopusg1':
        assessments_left = OctopusG1Assessment.objects.filter(user=request.
            user, tested_eye=0).order_by('date').reverse()[:3]
        assessments_right = OctopusG1Assessment.objects.filter(user=request
            .user, tested_eye=1).order_by('date').reverse()[:3]
        context = {'left': assessments_left, 'right': assessments_right,
            'program_type': program_type}
    return render(request, 'stats/index.html', context)

# Copyright 2019 Matthias Ring
# Machine Learning and Data Analytics Lab
# Friedrich-Alexander-University Erlangen-Nuremberg
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from django.shortcuts import render

from assessment.models import EquidistantAssessment, OctopusG1Assessment


def index(request):
    context = {'program_type': None}
    program_type = request.GET.get('program_type', 'equidistant')

    if program_type == 'equidistant':
        assessments_left = EquidistantAssessment.objects.filter(user=request.user, tested_eye=0) \
                               .order_by('date').reverse()[:3]
        assessments_right = EquidistantAssessment.objects.filter(user=request.user, tested_eye=1) \
                                .order_by('date').reverse()[:3]

        context = {'left': assessments_left, 'right': assessments_right, 'program_type': program_type}

    elif program_type == 'octopusg1':
        assessments_left = OctopusG1Assessment.objects.filter(user=request.user, tested_eye=0) \
                               .order_by('date').reverse()[:3]
        assessments_right = OctopusG1Assessment.objects.filter(user=request.user, tested_eye=1) \
                                .order_by('date').reverse()[:3]

        context = {'left': assessments_left, 'right': assessments_right, 'program_type': program_type}

    return render(request, 'stats/index.html', context)
