From b28ac4f75e48a8f8dfd000dc3ca7c3310691d7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Robidas?= Date: Sun, 11 Feb 2024 19:55:55 -0500 Subject: [PATCH] Updated time allocation and time limit preview --- frontend/tasks.py | 5 +---- frontend/templates/frontend/form/type_head.js | 3 ++- frontend/templates/frontend/launch.html | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/tasks.py b/frontend/tasks.py index c255d671..aeadf260 100644 --- a/frontend/tasks.py +++ b/frontend/tasks.py @@ -5220,16 +5220,13 @@ def create_account_sub(email): def create_subscription( user, stripe_sub_id, end_date, allocation, stripe_cus_id, will_renew ): - time_left = max(0, user.allocated_seconds - user.billed_seconds) - sub_amount = max(allocation - time_left, 0) - # Make sure we don't create a duplicate subscription and allocation try: sub = Subscription.objects.get(subscriber=user, end_date=end_date) except Subscription.DoesNotExist: alloc = ResourceAllocation.objects.create( code=get_random_string(32), - allocation_seconds=sub_amount, + allocation_seconds=allocation, note=ResourceAllocation.SUBSCRIPTION, ) alloc.redeem(user) diff --git a/frontend/templates/frontend/form/type_head.js b/frontend/templates/frontend/form/type_head.js index 4737617b..ea3cfd72 100644 --- a/frontend/templates/frontend/form/type_head.js +++ b/frontend/templates/frontend/form/type_head.js @@ -32,9 +32,10 @@ function calc_selection_changed() { viewer.styles.atoms_displayLabels_3D = false; } } + software = document.getElementById("calc_software"); msg = document.getElementById("cloud_num_cores"); if(msg) { - if(choice.value == "Conformational Search" || choice.value == "Constrained Conformational Search") { + if(software.value == "NWChem" || choice.value == "Conformational Search" || choice.value == "Constrained Conformational Search") { // Hardcoded values for now... $("#cloud_num_cores").html({% if request.user.is_trial %}"4"{% else %}"8"{% endif %}); } diff --git a/frontend/templates/frontend/launch.html b/frontend/templates/frontend/launch.html index f7605f15..e08c87e3 100755 --- a/frontend/templates/frontend/launch.html +++ b/frontend/templates/frontend/launch.html @@ -122,7 +122,7 @@ {% if IS_CLOUD %}
- 1 to 4 core will be used (maximum runtime: {% if request.user.is_trial %}5 minutes{% elif request.user.is_subscriber %}6 hours{% else %}15 minutes{% endif %}) + 1 to 4 core will be used (maximum runtime: {% if request.user.is_trial %}5 minutes{% elif request.user.is_subscriber %}24 hours{% else %}15 minutes{% endif %}) {% if request.user.is_trial %}
You are using a trial account. Convert to a free full account to unlock more computing power and longer runtimes