Exemple #1
0
def selected(request, outputtype):
    ekg = SelectedEKG.objects.all()[0].ekg

    if ekg.pulse_generated == False:
        generate_pulses(ekg)
        ekg.pulse_generated = True
        ekg.save()

    available_pulses = Pulse.objects.filter(ekg=ekg).order_by("id")
    number_of_pulses = len(available_pulses)

    if ekg.last_sent == (number_of_pulses-1):
        current = 1
    else:
        current = ekg.last_sent + 1

    pulse = available_pulses[current]
    ekg.last_sent = current
    ekg.save()

    if outputtype == 'json':
        return render_to_response('instant.json',
                                  {"pulse": pulse},
                                  mimetype='application/json')
    return render_to_response('instant.html',
                              {"pulse": pulse})
Exemple #2
0
def instant(request, ekg_id, outputtype):
    if int(ekg_id) == 0:
        ekg = choice(EKG.objects.all())
        rastgele = True
    else:
        ekg = get_object_or_404(EKG, id=ekg_id)
        rastgele = False

    if ekg.pulse_generated == False:
        generate_pulses(ekg)
        ekg.pulse_generated = True
        ekg.save()

    available_pulses = Pulse.objects.filter(ekg=ekg).order_by("id")
    number_of_pulses = len(available_pulses)

    if ekg.last_sent == (number_of_pulses-1):
        current = 1
    else:
        current = ekg.last_sent + 1

    pulse = available_pulses[current]
    ekg.last_sent = current
    ekg.save()

    if outputtype == 'json':
        return render_to_response('instant.json',
                                  {"pulse": pulse, "rastgele": rastgele},
                                  mimetype='application/json')
    return render_to_response('instant.html',
                              {"pulse": pulse, "rastgele": rastgele})
Exemple #3
0
def instant(request, ekg_id, outputtype):
    if int(ekg_id) == 0:
        ekg = choice(EKG.objects.all())
        rastgele = True
    else:
        ekg = get_object_or_404(EKG, id=ekg_id)
        rastgele = False

    if ekg.pulse_generated == False:
        generate_pulses(ekg)
        ekg.pulse_generated = True
        ekg.save()

    available_pulses = Pulse.objects.filter(ekg=ekg).order_by("id")
    number_of_pulses = len(available_pulses)

    if ekg.last_sent == (number_of_pulses - 1):
        current = 1
    else:
        current = ekg.last_sent + 1

    pulse = available_pulses[current]
    ekg.last_sent = current
    ekg.save()

    if outputtype == 'json':
        return render_to_response('instant.json', {
            "pulse": pulse,
            "rastgele": rastgele
        },
                                  mimetype='application/json')
    return render_to_response('instant.html', {
        "pulse": pulse,
        "rastgele": rastgele
    })
Exemple #4
0
def ekg(request, ekg_id, outputtype):
    ekg = get_object_or_404(EKG, id=ekg_id)
    if ekg.pulse_generated == False:
        generate_pulses(ekg)
        ekg.pulse_generated = True
        ekg.save()

    pulses = Pulse.objects.filter(ekg=ekg).order_by("id")
    if outputtype == 'json':
        return render_to_response('ekg.json', {"ekg": ekg, "pulses":pulses},
                                  mimetype='application/json')
    return render_to_response('ekg.html', {"ekg": ekg, "pulses":pulses})
Exemple #5
0
def ekg(request, ekg_id, outputtype):
    ekg = get_object_or_404(EKG, id=ekg_id)
    if ekg.pulse_generated == False:
        generate_pulses(ekg)
        ekg.pulse_generated = True
        ekg.save()

    pulses = Pulse.objects.filter(ekg=ekg).order_by("id")
    if outputtype == 'json':
        return render_to_response('ekg.json', {
            "ekg": ekg,
            "pulses": pulses
        },
                                  mimetype='application/json')
    return render_to_response('ekg.html', {"ekg": ekg, "pulses": pulses})
Exemple #6
0
def selected(request, outputtype):
    ekg = SelectedEKG.objects.all()[0].ekg

    if ekg.pulse_generated == False:
        generate_pulses(ekg)
        ekg.pulse_generated = True
        ekg.save()

    available_pulses = Pulse.objects.filter(ekg=ekg).order_by("id")
    number_of_pulses = len(available_pulses)

    if ekg.last_sent == (number_of_pulses - 1):
        current = 1
    else:
        current = ekg.last_sent + 1

    pulse = available_pulses[current]
    ekg.last_sent = current
    ekg.save()

    if outputtype == 'json':
        return render_to_response('instant.json', {"pulse": pulse},
                                  mimetype='application/json')
    return render_to_response('instant.html', {"pulse": pulse})