diff --git a/app/__pycache__/views.cpython-311.pyc b/app/__pycache__/views.cpython-311.pyc index cb6495047..7b3f9d6a7 100644 Binary files a/app/__pycache__/views.cpython-311.pyc and b/app/__pycache__/views.cpython-311.pyc differ diff --git a/app/views.py b/app/views.py index 185078c82..9ad99b419 100644 --- a/app/views.py +++ b/app/views.py @@ -114,8 +114,9 @@ def breathUpdate(request): return HttpResponse("Request method is not a POST") def mitralVolumeChange(request): + global current_mitral_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_mitral_valve_sound: volume = request.POST['rangeValue'] os.system('amixer -c 3 set Speaker {}%'.format(volume)) print('Mitral Valve\'s Volume updated to {}%'.format(volume)) @@ -124,33 +125,45 @@ def mitralVolumeChange(request): return HttpResponse("Request method is not a POST") def aorticVolumeChange(request): + global current_aortic_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_aortic_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 4 set Speaker {}%'.format(volume)) + print('Aortic Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST") def pulmonaryVolumeChange(request): + global current_pulmonary_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_pulmonary_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 5 set Speaker {}%'.format(volume)) + print('Pulmonary Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST") def tricuspidVolumeChange(request): + global current_tricuspid_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_tricuspid_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 6 set Speaker {}%'.format(volume)) + print('Tricuspid Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST") def erbVolumeChange(request): + global current_erb_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_erb_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 7 set Speaker {}%'.format(volume)) + print('Erb Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST")