Skip to content

Commit 97fc58b

Browse files
fugal-dyStefan BorerJean-Louis FuchsDavid Vogtluytena
authored
Chore rebase on main (#1679)
* chore(deps): update graphene-django Update to graphene-django 2.12.1 and fix connection field, schema. * chore(deps): add pytest-xfaillist plugin * chore(deps): switch to graphql 3.0 * chore: fix ResolveInfo fixture * chore(test): ensure name is valid identifier * chore(deps): remove XPASSing tests from xfails * chore(deps): handle enum in JSONValueFilter * chore(deps): remove passing tests from xfails.list * fix(tests): hand over UUID as string * chore(deps): get ordering value from Enum if any * chore(deps): use graphene's updated data types issue #814 * chore(deps): update and sort xfaillist * chore(deps): remove passing test from xfaillist #814 * chore(deps): handle enum in filter #814 * check if these tests are correct if so fixup commit with previous * chore(deps): upgrade pytest-xfaillist * chore(deps): pass kwargs to data source resolver (#1643) * fix(graphene): make more tests work (#1644) * Introduce our own choices field (for now): Graphene seems to already instantiate Enum instances from the request data, which causes the regular DRF choice field to fail, as the enum object isn't handled * Fix a few resolvers which now receive additional (unused by use) parameters * Graphene django v3 (#1645) * fix(datasource): accept new additional parameters from graphene * fix(filters): overload resolve_queryset() to support multi order_by Graphene does not really support order_by with multiple values like we need it. There's a bug in graphene that we need to work around: graphql-python/graphene-django#1280 While we're at it, also clean up some more data. * fix(historical): fix uuid and resolver params (#1646) * fix(historical): fix uuid and resolver params * fix(form): accept new additional resolver args * Graphene django v3 (#1647) * fix(tests): adjust test to new error message style graphene 3.0 returns a text fragment of the offending query * fix(middleware): use new visitor and ast conventions The node types are not CamelCase named, but snake_cased. Also, the operation is an AST object, not a bare string. In queries without variables, the variables MUST NOT be set to an empty string. (None works however...) * fix(cases): various fixes in csae filter and tests * fix(schema): make schema tests work again (sort of) The schema test relies on stringification of the root schema object. This currently fails due to a function within the graphql core package being unable to handle django lazy translation objects. The test setup is rigged such that once upstream fixes the problem, it will trigger a failure here and we can remove the hacky workaround. * fix(tests): more tests fixed with correct (non-uuid) input objects Also remove passing some info objects to schema_executor(), it doesn't accept them anymore (just pass context_value as that's the interesting bit) * fix(tests): stringify localized fields when passing to gql * chore(coverage): improve coverage Most of the lines that were "not covered" will never happen or are error cases such as raising validation errors, or other non-problematic parts. * fix(tests): sort the schema type map (#1648) A sorted type map (as it used to be in older graphene versions) helps better comparing / diffing the schema * Graphene django v3 (#1649) * chore: coverage back to 100% * chore: fix conflict in setup.py * fix(schema): use explicit types for case status and workitem status Graphene would otherwise use an automatic naming scheme that breaks our clients * fix: coverage in new status fields (#1650) Those status fields are only used for the type system, but not as actual input types. Thus, they're never actually instantiated * rebase graphene update branch on main (#1664) * feat(form): enable hint messages on questions (#1655) Add a hint text field on all question types except for form, static and action button questions. This functionality requires a db migration. * feat(workflow): implement WorkItem redo pattern (#1656) This commit implements a possibility to redo an already finished WorkItem and all the ones that were finished in between. Closes #1510 * chore: update dependencies (#1660) * chore: cleanup `WorkItem.get_redoable()` * chore: update dependencies * chore: release 7.15 (#1661) * chore: add a code of conduct (#1651) * chore(deps): update graphene-django Update to graphene-django 2.12.1 and fix connection field, schema. * chore(deps): add pytest-xfaillist plugin * chore(deps): switch to graphql 3.0 * chore: fix ResolveInfo fixture * chore(test): ensure name is valid identifier * chore(deps): remove XPASSing tests from xfails * chore(deps): handle enum in JSONValueFilter * chore(deps): remove passing tests from xfails.list * fix(tests): hand over UUID as string * chore(deps): get ordering value from Enum if any * chore(deps): use graphene's updated data types issue #814 * chore(deps): update and sort xfaillist * chore(deps): remove passing test from xfaillist #814 * chore(deps): handle enum in filter #814 * check if these tests are correct if so fixup commit with previous * chore(deps): upgrade pytest-xfaillist * chore(deps): pass kwargs to data source resolver (#1643) * fix(graphene): make more tests work (#1644) * Introduce our own choices field (for now): Graphene seems to already instantiate Enum instances from the request data, which causes the regular DRF choice field to fail, as the enum object isn't handled * Fix a few resolvers which now receive additional (unused by use) parameters * Graphene django v3 (#1645) * fix(datasource): accept new additional parameters from graphene * fix(filters): overload resolve_queryset() to support multi order_by Graphene does not really support order_by with multiple values like we need it. There's a bug in graphene that we need to work around: graphql-python/graphene-django#1280 While we're at it, also clean up some more data. * fix(historical): fix uuid and resolver params (#1646) * fix(historical): fix uuid and resolver params * fix(form): accept new additional resolver args * Graphene django v3 (#1647) * fix(tests): adjust test to new error message style graphene 3.0 returns a text fragment of the offending query * fix(middleware): use new visitor and ast conventions The node types are not CamelCase named, but snake_cased. Also, the operation is an AST object, not a bare string. In queries without variables, the variables MUST NOT be set to an empty string. (None works however...) * fix(cases): various fixes in csae filter and tests * fix(schema): make schema tests work again (sort of) The schema test relies on stringification of the root schema object. This currently fails due to a function within the graphql core package being unable to handle django lazy translation objects. The test setup is rigged such that once upstream fixes the problem, it will trigger a failure here and we can remove the hacky workaround. * fix(tests): more tests fixed with correct (non-uuid) input objects Also remove passing some info objects to schema_executor(), it doesn't accept them anymore (just pass context_value as that's the interesting bit) * fix(tests): stringify localized fields when passing to gql * chore(coverage): improve coverage Most of the lines that were "not covered" will never happen or are error cases such as raising validation errors, or other non-problematic parts. * fix(tests): sort the schema type map (#1648) A sorted type map (as it used to be in older graphene versions) helps better comparing / diffing the schema * Graphene django v3 (#1649) * chore: coverage back to 100% * chore: fix conflict in setup.py * fix(schema): use explicit types for case status and workitem status Graphene would otherwise use an automatic naming scheme that breaks our clients * fix: coverage in new status fields (#1650) Those status fields are only used for the type system, but not as actual input types. Thus, they're never actually instantiated * fix: pin graphql-relay to <3.1.1 the minor version includes deprecation of backwards compatibility measures. See graphql-python/graphql-relay-py#45 Might include other changes that are unrelated to the above that break a number of our tests. * update snapshots for test_question * fix(test): fix UUID * fix(tests): update test_workflow snapshot * fix: remove schema workaround and update snapshot Co-authored-by: luytena <[email protected]> Co-authored-by: Fabio Ambauen <[email protected]> Co-authored-by: David Vogt <[email protected]> Co-authored-by: Christian Zosel <[email protected]> Co-authored-by: Stefan Borer <[email protected]> Co-authored-by: Jean-Louis Fuchs <[email protected]> * chore: cleanup schema test workaround * fix(coverage): raise cov and fix a typo * chore(deps): update graphene-django * chore(deps): Update to graphene-django 2.12.1 and fix connection field, schema. * chore(deps): add pytest-xfaillist plugin * chore(deps): switch to graphql 3.0 * chore: fix ResolveInfo fixture * chore(test): ensure name is valid identifier * chore(deps): handle enum in JSONValueFilter * fix(tests): hand over UUID as string * chore(deps): get ordering value from Enum if any * chore(deps): use graphene's updated data types issue #814 * chore(deps): handle enum in filter #814 * chore(deps): pass kwargs to data source resolver (#1643) * fix(graphene): make more tests work (#1644) * Introduce our own choices field (for now): Graphene seems to already instantiate Enum instances from the request data, which causes the regular DRF choice field to fail, as the enum object isn't handled * Fix a few resolvers which now receive additional (unused by use) parameters * Graphene django v3 (#1645) * fix(datasource): accept new additional parameters from graphene * fix(filters): overload resolve_queryset() to support multi order_by Graphene does not really support order_by with multiple values like we need it. There's a bug in graphene that we need to work around: graphql-python/graphene-django#1280 While we're at it, also clean up some more data. * fix(historical): fix uuid and resolver params (#1646) * fix(historical): fix uuid and resolver params * fix(form): accept new additional resolver args * Graphene django v3 (#1647) * fix(tests): adjust test to new error message style graphene 3.0 returns a text fragment of the offending query * fix(middleware): use new visitor and ast conventions The node types are not CamelCase named, but snake_cased. Also, the operation is an AST object, not a bare string. In queries without variables, the variables MUST NOT be set to an empty string. (None works however...) * fix(cases): various fixes in csae filter and tests * fix(schema): make schema tests work again (sort of) The schema test relies on stringification of the root schema object. This currently fails due to a function within the graphql core package being unable to handle django lazy translation objects. The test setup is rigged such that once upstream fixes the problem, it will trigger a failure here and we can remove the hacky workaround. * fix(tests): more tests fixed with correct (non-uuid) input objects Also remove passing some info objects to schema_executor(), it doesn't accept them anymore (just pass context_value as that's the interesting bit) * fix(tests): stringify localized fields when passing to gql * chore(coverage): improve coverage Most of the lines that were "not covered" will never happen or are error cases such as raising validation errors, or other non-problematic parts. * fix(tests): sort the schema type map (#1648) A sorted type map (as it used to be in older graphene versions) helps better comparing / diffing the schema * Graphene django v3 (#1649) * chore: coverage back to 100% * chore: fix conflict in setup.py * fix(schema): use explicit types for case status and workitem status Graphene would otherwise use an automatic naming scheme that breaks our clients * fix: coverage in new status fields (#1650) Those status fields are only used for the type system, but not as actual input types. Thus, they're never actually instantiated * rebase graphene update branch on main (#1664) * feat(form): enable hint messages on questions (#1655) Add a hint text field on all question types except for form, static and action button questions. This functionality requires a db migration. * feat(workflow): implement WorkItem redo pattern (#1656) This commit implements a possibility to redo an already finished WorkItem and all the ones that were finished in between. Closes #1510 * chore: update dependencies (#1660) * chore: cleanup `WorkItem.get_redoable()` * chore: update dependencies * chore: release 7.15 (#1661) * chore: add a code of conduct (#1651) * chore(deps): update graphene-django Update to graphene-django 2.12.1 and fix connection field, schema. * chore(deps): add pytest-xfaillist plugin * chore(deps): switch to graphql 3.0 * chore: fix ResolveInfo fixture * chore(test): ensure name is valid identifier * chore(deps): remove XPASSing tests from xfails * chore(deps): handle enum in JSONValueFilter * chore(deps): remove passing tests from xfails.list * fix(tests): hand over UUID as string * chore(deps): get ordering value from Enum if any * chore(deps): use graphene's updated data types issue #814 * chore(deps): update and sort xfaillist * chore(deps): remove passing test from xfaillist #814 * chore(deps): handle enum in filter #814 * check if these tests are correct if so fixup commit with previous * chore(deps): upgrade pytest-xfaillist * chore(deps): pass kwargs to data source resolver (#1643) * fix(graphene): make more tests work (#1644) * Introduce our own choices field (for now): Graphene seems to already instantiate Enum instances from the request data, which causes the regular DRF choice field to fail, as the enum object isn't handled * Fix a few resolvers which now receive additional (unused by use) parameters * Graphene django v3 (#1645) * fix(datasource): accept new additional parameters from graphene * fix(filters): overload resolve_queryset() to support multi order_by Graphene does not really support order_by with multiple values like we need it. There's a bug in graphene that we need to work around: graphql-python/graphene-django#1280 While we're at it, also clean up some more data. * fix(historical): fix uuid and resolver params (#1646) * fix(historical): fix uuid and resolver params * fix(form): accept new additional resolver args * Graphene django v3 (#1647) * fix(tests): adjust test to new error message style graphene 3.0 returns a text fragment of the offending query * fix(middleware): use new visitor and ast conventions The node types are not CamelCase named, but snake_cased. Also, the operation is an AST object, not a bare string. In queries without variables, the variables MUST NOT be set to an empty string. (None works however...) * fix(cases): various fixes in csae filter and tests * fix(schema): make schema tests work again (sort of) The schema test relies on stringification of the root schema object. This currently fails due to a function within the graphql core package being unable to handle django lazy translation objects. The test setup is rigged such that once upstream fixes the problem, it will trigger a failure here and we can remove the hacky workaround. * fix(tests): more tests fixed with correct (non-uuid) input objects Also remove passing some info objects to schema_executor(), it doesn't accept them anymore (just pass context_value as that's the interesting bit) * fix(tests): stringify localized fields when passing to gql * chore(coverage): improve coverage Most of the lines that were "not covered" will never happen or are error cases such as raising validation errors, or other non-problematic parts. * fix(tests): sort the schema type map (#1648) A sorted type map (as it used to be in older graphene versions) helps better comparing / diffing the schema * Graphene django v3 (#1649) * chore: coverage back to 100% * chore: fix conflict in setup.py * fix(schema): use explicit types for case status and workitem status Graphene would otherwise use an automatic naming scheme that breaks our clients * fix: coverage in new status fields (#1650) Those status fields are only used for the type system, but not as actual input types. Thus, they're never actually instantiated * fix: pin graphql-relay to <3.1.1 the minor version includes deprecation of backwards compatibility measures. See graphql-python/graphql-relay-py#45 Might include other changes that are unrelated to the above that break a number of our tests. * update snapshots for test_question * fix(test): fix UUID * fix(tests): update test_workflow snapshot * fix: remove schema workaround and update snapshot Co-authored-by: luytena <[email protected]> Co-authored-by: Fabio Ambauen <[email protected]> Co-authored-by: David Vogt <[email protected]> Co-authored-by: Christian Zosel <[email protected]> Co-authored-by: Stefan Borer <[email protected]> Co-authored-by: Jean-Louis Fuchs <[email protected]> * chore: cleanup schema test workaround * feat(form): enable hint messages on questions (#1655) Add a hint text field on all question types except for form, static and action button questions. This functionality requires a db migration. * feat(workflow): implement WorkItem redo pattern (#1656) This commit implements a possibility to redo an already finished WorkItem and all the ones that were finished in between. Closes #1510 * fix(coverage): raise cov and fix a typo * fixme: question snapshot differs * fixme: caluma analytics snapshot differs and tests fail * fix: incomplete merge * chore(analytics): compatibility cleanups Co-authored-by: Stefan Borer <[email protected]> Co-authored-by: Jean-Louis Fuchs <[email protected]> Co-authored-by: David Vogt <[email protected]> Co-authored-by: luytena <[email protected]> Co-authored-by: Fabio Ambauen <[email protected]> Co-authored-by: Christian Zosel <[email protected]>
1 parent 36886f2 commit 97fc58b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3053
-56145
lines changed

.reuse/dep5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Source: https://github.com/projectcaluma/caluma
55

66
# Files below the threshold of originality (metadata, config and project-information)
77
Files:
8+
deps/
9+
xfails.list
810
.dockerignore
911
.editorconfig
1012
.github/dependabot.yml

caluma/caluma_analytics/schema.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import graphene
22
from graphene import ConnectionField, String, relay
33
from graphene.types import ObjectType, generic
4+
from graphene_django.rest_framework import serializer_converter
45

56
from ..caluma_core.filters import (
67
CollectionFilterSetFactory,
@@ -74,6 +75,16 @@ def resolve_records(table, info, *args, **kwargs):
7475
return rows
7576

7677

78+
StartingObject = graphene.Enum(
79+
"StartingObject",
80+
[(key.upper(), key) for key, _ in models.AnalyticsTable.STARTING_OBJECT_CHOICES],
81+
)
82+
83+
serializer_converter.get_graphene_type_from_serializer_field.register(
84+
serializers.StartingObjectField, lambda field: StartingObject
85+
)
86+
87+
7788
class AnalyticsTable(DjangoObjectType):
7889
available_fields = ConnectionField(
7990
AvailableFieldConnection,
@@ -83,10 +94,10 @@ class AnalyticsTable(DjangoObjectType):
8394
result_data = graphene.Field(AnalyticsOutput)
8495

8596
@staticmethod
86-
def resolve_available_fields(obj, info, prefix=None, depth=0):
97+
def resolve_available_fields(obj, info, prefix=None, depth=None, **kwargs):
8798
start = obj.get_starting_object(info)
8899

89-
depth = depth if depth > 0 else 1
100+
depth = depth if depth and depth > 0 else 1
90101
prefix = prefix.split(".") if prefix else []
91102

92103
return [
@@ -117,7 +128,6 @@ class AnalyticsField(DjangoObjectType):
117128

118129
class Meta:
119130
model = models.AnalyticsField
120-
# exclude = ("cases", "task_flows")
121131
interfaces = (relay.Node,)
122132
connection_class = CountableConnectionBase
123133

caluma/caluma_analytics/serializers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
from . import models
66

77

8+
class StartingObjectField(serializers.CalumaChoiceField):
9+
def __init__(self, **kwargs):
10+
super().__init__(models.AnalyticsTable.STARTING_OBJECT_CHOICES, **kwargs)
11+
12+
813
class SaveAnalyticsTableSerializer(serializers.ModelSerializer):
14+
starting_object = StartingObjectField(required=True)
15+
916
class Meta:
1017
model = models.AnalyticsTable
1118
fields = [

caluma/caluma_analytics/tests/__snapshots__/test_run_analytics_cmdline.ambr

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
# name: test_cmdline_output[output_mode0-False-expect_output1]
22
<class 'dict'> {
3-
'data': '
4-
case_id blablub
5-
------------------------------------ ---------------
6-
case1pk Shelly Watson
7-
case2pk Ruben Ibarra
8-
case3pk Katelyn Mcgrath
9-
10-
',
3+
'data': <class 'list'> [
4+
'------------------------------------ --------------- ',
5+
'case1pk Shelly Watson ',
6+
'case2pk Ruben Ibarra ',
7+
'case3pk Katelyn Mcgrath ',
8+
'case_id blablub ',
9+
],
1110
'stderr': '',
1211
}
1312
---
1413
# name: test_cmdline_output[output_mode0-True-expect_output0]
1514
<class 'dict'> {
16-
'data': '
17-
case_id blablub
18-
------------------------------------ -------------
19-
case1pk Shelly Watson
20-
case2pk Ruben Ibarra
21-
22-
',
15+
'data': <class 'list'> [
16+
'------------------------------------ ------------- ',
17+
'case1pk Shelly Watson ',
18+
'case2pk Ruben Ibarra ',
19+
'case_id blablub ',
20+
],
2321
'stderr': '',
2422
}
2523
---
2624
# name: test_cmdline_output[output_mode1-False-expect_output1]
2725
<class 'dict'> {
28-
'data': '
29-
case_id blablub
30-
------------------------------------ ---------------
31-
case1pk Shelly Watson
32-
case2pk Ruben Ibarra
33-
case3pk Katelyn Mcgrath
34-
35-
',
26+
'data': <class 'list'> [
27+
'------------------------------------ --------------- ',
28+
'case1pk Shelly Watson ',
29+
'case2pk Ruben Ibarra ',
30+
'case3pk Katelyn Mcgrath ',
31+
'case_id blablub ',
32+
],
3633
'stderr': '
3734
-- SQL:
3835
WITH
@@ -115,13 +112,12 @@
115112
---
116113
# name: test_cmdline_output[output_mode1-True-expect_output0]
117114
<class 'dict'> {
118-
'data': '
119-
case_id blablub
120-
------------------------------------ -------------
121-
case1pk Shelly Watson
122-
case2pk Ruben Ibarra
123-
124-
',
115+
'data': <class 'list'> [
116+
'------------------------------------ ------------- ',
117+
'case1pk Shelly Watson ',
118+
'case2pk Ruben Ibarra ',
119+
'case_id blablub ',
120+
],
125121
'stderr': '
126122
-- SQL:
127123
WITH
@@ -207,7 +203,8 @@
207203
---
208204
# name: test_cmdline_output[output_mode2-False-expect_output1]
209205
<class 'dict'> {
210-
'data': '',
206+
'data': <class 'list'> [
207+
],
211208
'stderr': '
212209
-- SQL:
213210
WITH
@@ -290,7 +287,8 @@
290287
---
291288
# name: test_cmdline_output[output_mode2-True-expect_output0]
292289
<class 'dict'> {
293-
'data': '',
290+
'data': <class 'list'> [
291+
],
294292
'stderr': '
295293
-- SQL:
296294
WITH
@@ -378,16 +376,16 @@
378376
<class 'dict'> {
379377
'data': <class 'list'> [
380378
<class 'dict'> {
381-
'blablub': 'Shelly Watson',
382-
'case_id': 'case1pk',
379+
'blablub': 'Katelyn Mcgrath',
380+
'case_id': 'case3pk',
383381
},
384382
<class 'dict'> {
385383
'blablub': 'Ruben Ibarra',
386384
'case_id': 'case2pk',
387385
},
388386
<class 'dict'> {
389-
'blablub': 'Katelyn Mcgrath',
390-
'case_id': 'case3pk',
387+
'blablub': 'Shelly Watson',
388+
'case_id': 'case1pk',
391389
},
392390
],
393391
'stderr': '',
@@ -396,14 +394,14 @@
396394
# name: test_cmdline_output[output_mode3-True-expect_output0]
397395
<class 'dict'> {
398396
'data': <class 'list'> [
399-
<class 'dict'> {
400-
'blablub': 'Shelly Watson',
401-
'case_id': 'case1pk',
402-
},
403397
<class 'dict'> {
404398
'blablub': 'Ruben Ibarra',
405399
'case_id': 'case2pk',
406400
},
401+
<class 'dict'> {
402+
'blablub': 'Shelly Watson',
403+
'case_id': 'case1pk',
404+
},
407405
],
408406
'stderr': '',
409407
}

0 commit comments

Comments
 (0)