Commit graph

227 commits

Author SHA1 Message Date
Gavin D'souza
ae592521fc
fix: Clear cache when EPS enabled/disabled 2024-10-29 13:12:05 +01:00
David Arnold
c114e5fae8
refactor: unit vs integration treewide (#27992)
* refactor: constitute unit test case

* fix: docs and type hints

* refactor: mark presumed integration test cases explicitly

At time of writing, we now have at least two base test classes:

- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase

They load in their perspective priority queue during execution.

Probably more to come for more efficient queing and scheduling.

In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.

* feat: Move test-related functions from test_runner.py to tests/utils.py

* refactor: add bare UnitTestCase to all doctype tests

This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
2024-10-06 09:43:36 +00:00
Ankush Menat
3896296c6f fix: update sort order in doctypes 2024-03-27 11:18:28 +05:30
Ankush Menat
b1a8bc9312
fix: Export None as type if select as no options (#25211)
Select options can be dynamic, in that case we should at least the
default value `None` as a value `DF.Literal` otherwise is invalid type
annotation.
2024-03-04 06:42:41 +00:00
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Corentin Flr
4f809630c5
fix: Set sort_order to DESC if sort_field is modified (#23697)
Global search and replace operation, including single doctypes where it does not really matter.
2023-12-13 09:52:14 +05:30
Akhil Narang
fbc88a4d24
refactor(treewide): code cleanup
Drop redundant bool conversion

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-23 13:57:51 +05:30
Maharshi Patel
83f2227cdb
fix: review points when added more then once. (#23239)
* fix: review points when added more then once.

previously when user added review more then once it didn't work properly
because of apply_only_once check which is only meant for rule based points
changed that behaviour to only check when called from energy_point_rule by checking if doc.rule is set.
2023-11-22 12:31:35 +05:30
Ankush Menat
85956ed0c1 test: switch user before modifying other user 2023-08-29 12:07:58 +05:30
Ankush Menat
dc8d7b019a refactor!: Lower roles from All To Desk User 2023-08-29 12:07:57 +05:30
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
Ankush Menat
927cd647e4 chore: generate type annotations 2023-07-24 15:32:48 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
075a2d778e feat: UnixTimestamp QB function 2023-01-09 12:05:52 +05:30
Gavin D'souza
c3c1848b2a fix: Restrict socket data to respective users after commit
Fix conditions to bother only those who asked for the data:
- Clear permissions cache only for updated users' data
- Defer appropriate events until commit to avoid ghost events
- Remove event unused by desk (and other apps)
2022-11-16 23:07:07 +05:30
Gavin D'souza
01fdb6a241 chore: Remove unused realtime updates
These events were added for supporting listeners in desk. The listeners
have thus been removed and these are now unnecessary messages published
to anyone landing on Frappe pages or on Desk.
2022-11-15 13:12:51 +05:30
Ankush Menat
3a5a45d8af perf: drop many unused indexes
- reference owner - only used for activity page which is unusable
  *anyway*
- same for timeline and link doctypes

perf: drop unused index from Commment

Can't find a single  query that uses this index

perf: drop pointless "Is home folder" index

just why? It's checkbox index with 1 entry which has unique name already

Most pointless index I've seen no far.

perf: Drop "attached to doctype" separate index

There is already a composite index for this.

perf: drop indexes from web page view log

BOTH are totally unused in any of the queries related to this doctype.

Only "website analytics" report uses this which doesn't even show this
data lmao.

perf: drop unused index from EPS log

We never filter by doctype or type. pointless indexing.

perf: fix up notification log indexes

- drop unused index
- add "for user" index
2022-09-14 14:28:47 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
Ankush Menat
40f27f908a style: format JS files with prettier 2022-08-04 14:51:01 +05:30
Gavin D'souza
85e3ee9403 chore: Minified DocType JSON notation from old verbose notation 2022-08-03 12:22:03 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Rushabh Mehta
d55986d56d fix(conflicts): fix conflicts' 2022-04-18 17:29:03 +05:30
Rushabh Mehta
57a55e4225 feat(minor): Add document reference to Error Log and doc.log_error 2022-04-18 17:29:03 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
ChillarAnand
747ac70795 fix: Fix energy point log test case 2022-02-28 16:59:05 +05:30
ChillarAnand
2b48c08340 fix: Fix flaky tests 2022-02-28 12:44:06 +05:30
Raffael Meyer
89922bae90
feat: utility methods for docstatus (#15515)
* feat: utility methods for docstatus

* refactor: use utility method for doctsatus

* refactor: enum for docstatus

* refactor: docstatus as property

* fix: set docstatus

* feat: docstatus extends int class

* test: docstatus of BaseDocument

* refactor: occurrences of docstatus

* fix: typo

* refactor: move docstatus to a separate file

* test: docstatus

* fix: sider
2022-02-04 07:41:25 +00:00
phot0n
17f8a70003 chore: remove post and post comment doctypes 2022-01-28 20:28:42 +05:30
barredterra
b1383df15a refactor: use is None instead of == None 2022-01-17 10:37:51 +01:00
mergify[bot]
4d4e51989d
Merge pull request #14993 from kennethsequeira/dis-eps
fix: Disable EPS by default
2021-11-17 11:45:36 +00:00
Ankush Menat
673c8baa2a test: fix EPS test after changing default value 2021-11-17 15:53:46 +05:30
Ankush Menat
3be669ed69
feat(ux): option to disable EPS notifications (#14992) 2021-11-17 14:07:20 +05:30
Kenneth Sequeira
6ec6fbaa8d
chore: disable eps by default 2021-11-16 23:28:19 +05:30
Ankush Menat
7aa8688a09 perf: remove "track changes" from log-like doctypes
Removed "Track Changes" from:

- Activity Log
- Error Log
- Error Snapshot
- Scheduled Job Log
- View Log
- Notification Log
- Route History
- Energy Point Log
- Web Page View

These documents dont change and even if they did it's useless to keep
track of it IMO. Removing this speeds up insertion and saves storage.
2021-10-29 12:20:13 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
ebc220db39 refactor(tests): frappe.db.delete > frappe.db.sql
Use frappe.db.delete wherever possible. Get rid of all the frappe.db.sql ;)
This commit focuses on the tests written under the doctype specific
tests
2021-08-19 19:50:48 +05:30
Suraj Shetty
bd91a33bb9 test: Add test case to validate EP for disabled user 2021-07-14 21:35:04 +05:30
Suraj Shetty
bd854bb368 fix: Do not create energy points for disabled users 2021-07-14 18:16:50 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Ankush Menat
7933b9c825
chore: replace assertNotEquals with assertNotEqual 2021-05-06 21:23:04 +05:30
Sagar Vora
497ea861f4 feat: frappe.whitelist for class methods 2021-03-30 13:07:58 +05:30
Parth J. Kharwar
9e5ca78d78 feat: enables, disables and deletes notification settings when a user is modified [CU-j8wutt] (#9) 2021-02-26 13:06:04 +05:30
Suraj Shetty
e6aa5394b8 feat: Add avatars for top performers 2021-01-21 11:18:59 +05:30
Rushabh Mehta
54cee87826 fix(minor): tests + routing 2020-12-24 14:48:40 +05:30
Shivam Mishra
dea1063c3e chore: remove print statement 2020-11-18 14:25:40 +05:30
Rushabh Mehta
75fe8a615a feat(app): move /desk to /app 2020-11-11 16:31:47 +05:30
Michelle Alva
00ee7f27b0
fix: Allow creation of Energy Point Log (#11651)
* fix: Enable in_create for Energy Point Log

* fix: enable in_create

* fix: remove in_create
2020-10-06 16:16:08 +00:00
Rushabh Mehta
b92b97fd9a fix(minor): clear cache for maps 2020-08-17 09:41:54 +05:30
Rushabh Mehta
b09beb9147 fix(tests): cleanup 2020-08-17 09:41:54 +05:30