mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 18:07:02 +00:00
sonar issues
This commit is contained in:
@ -103,3 +103,6 @@ MAX_ARTICLE_CARD = 6
|
|||||||
# min and max survey
|
# min and max survey
|
||||||
MIN_ARTICLE_SURVEY = 5
|
MIN_ARTICLE_SURVEY = 5
|
||||||
MAX_ARTICLE_SURVEY = 10
|
MAX_ARTICLE_SURVEY = 10
|
||||||
|
|
||||||
|
# real time url
|
||||||
|
time_url = "http://worldtimeapi.org/api/timezone/Asia/Riyadh"
|
||||||
|
@ -77,6 +77,7 @@ ERROR_CODE = {
|
|||||||
"2044": "Task does not exist",
|
"2044": "Task does not exist",
|
||||||
"2045": "Invalid guardian",
|
"2045": "Invalid guardian",
|
||||||
"2046": "Due date must be future date",
|
"2046": "Due date must be future date",
|
||||||
|
# invalid junior id msg
|
||||||
"2047": "Invalid Junior ID ",
|
"2047": "Invalid Junior ID ",
|
||||||
"2048": "Choose right file for image",
|
"2048": "Choose right file for image",
|
||||||
"2049": "This task is already requested "
|
"2049": "This task is already requested "
|
||||||
|
@ -10,7 +10,7 @@ import tempfile
|
|||||||
# Import date time module's function
|
# Import date time module's function
|
||||||
from datetime import datetime, time
|
from datetime import datetime, time
|
||||||
# import Number constant
|
# import Number constant
|
||||||
from base.constants import NUMBER
|
from base.constants import NUMBER, time_url
|
||||||
# Import Junior's model
|
# Import Junior's model
|
||||||
from junior.models import Junior, JuniorPoints
|
from junior.models import Junior, JuniorPoints
|
||||||
|
|
||||||
@ -45,8 +45,9 @@ def upload_image_to_alibaba(image, filename):
|
|||||||
return f"https://{settings.ALIYUN_OSS_BUCKET_NAME}.{settings.ALIYUN_OSS_ENDPOINT}/{new_filename}"
|
return f"https://{settings.ALIYUN_OSS_BUCKET_NAME}.{settings.ALIYUN_OSS_ENDPOINT}/{new_filename}"
|
||||||
|
|
||||||
|
|
||||||
def real_time(timezone='Asia/Riyadh'):
|
def real_time():
|
||||||
url = f'http://worldtimeapi.org/api/timezone/{timezone}'
|
"""fetch real time from world time api"""
|
||||||
|
url = time_url
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
@ -48,6 +48,7 @@ def junior_approval_mail(guardian, full_name):
|
|||||||
return full_name
|
return full_name
|
||||||
|
|
||||||
def update_positions_based_on_points():
|
def update_positions_based_on_points():
|
||||||
|
"""Update position of the junior"""
|
||||||
# First, retrieve all the JuniorPoints instances ordered by total_points in descending order.
|
# First, retrieve all the JuniorPoints instances ordered by total_points in descending order.
|
||||||
juniors_points = JuniorPoints.objects.order_by('-total_points')
|
juniors_points = JuniorPoints.objects.order_by('-total_points')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user