Refactored raw query and partial get_all building with db.query + qb
notation equivalent. Added type hints & f-strings.
Intent: This particular API (for field "assigned_to") was taking
a while to run so decided to refactor this in hopes of perf improvemnts.
Result: 50% reduction in response times :D
Custom / Dynamic filters like "Fiscal Year" type would be in broken
state upon Page refresh. This was because get_selected_value didn't
handle that.
Perf change: Don't call util to recompute value each time when value
exists in current context. The UI feels a lot less clunkier after this
change - reduced repeated seemingly unnecessary computations.
Prior to this, a request was made on every filter change for a
filters_config entry. The options would not change based on the List /
filters context since no such data is shared with the API. Hence, it
can be stored upon first request for re-use.
Eg: Current usage in ERPNext - fiscal year operator's options don't change
frequently.
This would cause Custom Operator to stay in a broken state. Eg:
ERPNext's Item list with while selecting filters as <"Created On",
"Fiscal Year"> would not set correct option type or fetch options.
Console would show the following error message:
base_list.js:431 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
at ListView.get_filter_value (base_list.js:431:22)
at frappe.ui.Filter.set_field (filter.js:249:43)
at HTMLSelectElement.<anonymous> (filter.js:122:9)
at HTMLSelectElement.dispatch (jquery.js:5430:27)
at HTMLSelectElement.elemData.handle (jquery.js:5234:28)
Currently this background job constantly fails because of the way query
is written:
1. It tries to find all docs to delete using select query
2. Deletes them by using `in query` with a HUGE amount of docs
3. Deletes child table with parent, again using `IN` query with huge
amount of docs.
This times out and never finishes on old sites.
Solution:
1. Modified deletion to straightaway delete all main table rows that are
older
2. Apply same deletion logic to child table rows.
PS: This has potential to leave some orphan child table rows behind for few more days iff modified time was later than parent doc (this is quite rare). But it's safe since child table doesn't contain "links" anyway.
Full Name and Email ID of a **User** are sensitive data.
With **Role and User Permissions** we can restrict which other users a user can see, thus maintaining data protection. This could be circumvented by using the `@mention` functionality in comments. It allows us to see all users and their names, regardless of our permissions.
This PR aims to fix this issue by using `get_list` instead of `get_all` while retrieving options for `@mention`.
email queue takes a long time and during that previously deleted tables
remain locked. Activity/Error logs are relatively faster to delete so
should moved last