Skip to content

Commit

Permalink
Update to 1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
kid1194 committed Jun 26, 2023
1 parent b724dbc commit 16fdd44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 36 deletions.
10 changes: 5 additions & 5 deletions active_users/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
app_license = "MIT"


is_frappe_above_v13 = int(frappe_version.split('.')[0]) > 13
is_frappe_above_v13 = int(frappe_version.split(".")[0]) > 13


app_include_css = [
'active_users.bundle.css'
"active_users.bundle.css"
] if is_frappe_above_v13 else [
'/assets/active_users/css/active_users.css'
"/assets/active_users/css/active_users.css"
]
app_include_js = [
'active_users.bundle.js'
"active_users.bundle.js"
] if is_frappe_above_v13 else [
'/assets/active_users/js/active_users.js'
"/assets/active_users/js/active_users.js"
]


Expand Down
32 changes: 1 addition & 31 deletions active_users/utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
# Licence: Please refer to LICENSE file


#import datetime
import json
#import math
import re

import frappe
from frappe import _dict
#from frappe import _dict, _
from frappe.utils import (
cint,
#cstr,
has_common,
now,
add_to_date,
Expand Down Expand Up @@ -126,7 +122,6 @@ def get_users():
data = frappe.get_all(
"User",
fields=["name", "full_name", "user_image"],
#fields=["name", "full_name", "user_image", "last_active"],
filters={
"enabled": 1,
"user_type": ["in", user_types],
Expand All @@ -136,10 +131,6 @@ def get_users():
limit_page_length=0,
)

#if data and isinstance(data, list):
# for user in data:
# user.last_active = abbr_time(user.last_active)

if app.refresh_interval >= _CACHE_INTERVAL_:
set_cache(_CACHE_, cache_key, _dict({
"data": data,
Expand All @@ -149,25 +140,4 @@ def get_users():
return {"users": data}
except Exception as exc:
log_error(exc)
return {"error": 1, "message": "Unable to get the list of active users."}


# def abbr_time(date: str):
# if not date:
# return ""
#
# try:
# date = datetime.datetime.strptime(date, DATETIME_FORMAT)
# now_dt = datetime.datetime.strptime(now(), DATETIME_FORMAT)
# dt_diff = now_dt - date
#
# dt_diff_seconds = (dt_diff.days * 86400.0) + dt_diff.seconds
#
# for i in range(0, 29):
# if dt_diff_seconds < (60.0 * (i + 1)):
# return _("{0}m").format(cstr(i))
#
# return ""
#
# except Exception as exc:
# return ""
return {"error": 1, "message": "Unable to get the list of active users."}

0 comments on commit 16fdd44

Please sign in to comment.