Skip to content

Commit

Permalink
fix: dynamic email templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish7515 committed Jul 15, 2024
1 parent 36ecba9 commit dec9763
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 179 deletions.
28 changes: 14 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
"CVAT_SERVERLESS": "1",
"ALLOWED_HOSTS": "*",
"IAM_OPA_BUNDLE": "1",
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"args": [
"runserver",
Expand Down Expand Up @@ -211,8 +211,8 @@
"django": true,
"cwd": "${workspaceFolder}",
"env": {
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"console": "internalConsole"
},
Expand All @@ -233,8 +233,8 @@
"django": true,
"cwd": "${workspaceFolder}",
"env": {
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"console": "internalConsole"
},
Expand All @@ -255,8 +255,8 @@
"django": true,
"cwd": "${workspaceFolder}",
"env": {
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"console": "internalConsole"
},
Expand All @@ -277,8 +277,8 @@
"django": true,
"cwd": "${workspaceFolder}",
"env": {
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"console": "internalConsole"
},
Expand All @@ -296,8 +296,8 @@
"-i", "1"
],
"env": {
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"console": "internalConsole"
},
Expand Down Expand Up @@ -356,8 +356,8 @@
"django": true,
"cwd": "${workspaceFolder}",
"env": {
"DJANGO_LOG_SERVER_HOST": "localhost",
"DJANGO_LOG_SERVER_PORT": "8282"
// "DJANGO_LOG_SERVER_HOST": "localhost",
// "DJANGO_LOG_SERVER_PORT": "8282"
},
"console": "internalConsole"
},
Expand Down
1 change: 1 addition & 0 deletions cvat/apps/dataset_manager/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: MIT

import json
import math
import soundfile
import shutil
Expand Down
6 changes: 3 additions & 3 deletions cvat/apps/dataset_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def export(dst_format, project_id=None, task_id=None, job_id=None, server_url=No
logger = slogger.job[job_id]
db_instance = Job.objects.get(pk=job_id)
if(db_instance.segment.task.data.original_chunk_type == DataChoice.AUDIO):
export_fn = task.export_audino_task
export_fn = task.export_audino_job
export_for = "audio"
else:
export_fn = task.export_task
export_fn = task.export_job

cache_ttl = get_export_cache_ttl(db_instance)

Expand All @@ -102,7 +102,7 @@ def export(dst_format, project_id=None, task_id=None, job_id=None, server_url=No
instance_update_time = max(tasks_update + [instance_update_time])

if export_for == "audio":
output_base = '%s-instance%f-%s' % ('dataset' if save_images else 'annotations', instance_update_time, make_file_name(to_snake_case(dst_format)))
output_base = '%s-instance%f-%s' % ('dataset' if save_images else 'annotations', instance_update_time.timestamp(), make_file_name(to_snake_case(dst_format)))
output_path = '%s.%s' % (output_base, "zip")
output_path = osp.join(cache_dir, output_path)
else:
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/background_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def setup_background_job(
user_id = self.request.user.id

func = self.export_callback
func_args = (self.db_instance.id, self.export_args.format, server_address, self.EXPORT_FOR)
func_args = (self.db_instance.id, self.export_args.format, server_address)
result_url = None

if self.export_args.location == Location.CLOUD_STORAGE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,19 @@ <h1 style="margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -1px; l
<!-- start copy -->
<tr>
<td align="left" bgcolor="#ffffff" style="padding: 24px; font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;">
{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}
<p>
{% if "cvat" in current_site.domain|lower %}
Thank you for signing up for CVAT!
{% blocktrans %}Thank you for signing up for CVAT!{% endblocktrans %}
{% else %}
Thank you for signing up for Audino!
{% blocktrans %}Thank you for signing up for Audino!{% endblocktrans %}
{% endif %}
</p>
<p style="margin: 0;">
To complete registration and start annotating, simply tap the button below and confirm your email address.
If you didn't create an account with <strong>{{ site_name }}</strong>,
you can safely delete this email.
{% blocktrans with site_name=current_site.name %}
To complete registration and start annotating, simply tap the button below and confirm your email address.
If you didn't create an account with <strong>{{ site_name }}</strong>, you can safely delete this email.
{% endblocktrans %}
</p>
{% endblocktrans %}
</td>
</tr>
<!-- end copy -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,22 @@ <h1 style="margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -1px; l
<!-- start copy -->
<tr>
<td align="left" bgcolor="#ffffff" style="padding: 24px; font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;">
{% blocktrans %}
<p>
{% if "cvat" in site_name|lower %}
{% blocktrans %}
You're receiving this email because you've been invited to join <strong>{{ organization_name }}</strong> organization in CVAT by <strong>{{ invitation_owner }}</strong> at {{ site_name }}.
{% endblocktrans %}
{% else %}
{% blocktrans %}
You're receiving this email because you've been invited to join <strong>{{ organization_name }}</strong> organization in Audino by <strong>{{ invitation_owner }}</strong> at {{ site_name }}.
{% endblocktrans %}
{% endif %}
</p>
<p style="margin: 0;">
To join organization and start annotating, simply tap the button below and complete registration.
{% blocktrans %}
To join organization and start annotating, simply tap the button below and complete registration.
{% endblocktrans %}
</p>
{% endblocktrans %}
</td>
</tr>
<!-- end copy -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}You're invited to join {{ organization_name }} organization in {% if "cvat" in site_name|lower %}CVAT{% else %}Audino{% endif %}!{% endblocktrans %}
{% endautoescape %}
{% if "cvat" in site_name|lower %}
{% blocktrans %}You're invited to join {{ organization_name }} organization in CVAT!{% endblocktrans %}
{% else %}
{% blocktrans %}You're invited to join {{ organization_name }} organization in Audino!{% endblocktrans %}
{% endif %}
{% endautoescape %}
Loading

0 comments on commit dec9763

Please sign in to comment.