Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce numeric attributes #6790

Merged
merged 26 commits into from
Apr 29, 2021
Merged

Introduce numeric attributes #6790

merged 26 commits into from
Apr 29, 2021

Conversation

IKarbowiak
Copy link
Member

@IKarbowiak IKarbowiak commented Jan 26, 2021

Allow creating and assigning numeric attributes.
Dasboard PR

Impact

  • New migrations
  • New/Updated API fields or mutations
  • Deprecated API fields or mutations
  • Removed API types, fields, or mutations
  • Documentation needs to be updated

Pull Request Checklist

  • Privileged queries and mutations are guarded by proper permission checks
  • Database queries are optimized and the number of queries is constant
  • Database migration files are up to date
  • The changes are tested
  • GraphQL schema and type definitions are up to date
  • Changes are mentioned in the changelog

IKarbowiak and others added 13 commits January 20, 2021 12:52
* Add NUMERIC AttributeInputType

* Prepare units enum

* Add measurement units and unit field to attribute

* Allow defining unit in AttributeCreate mutation

* Add test for query numeric attribute and update test for getting variant selection attributes

* Add validation for numeric attribute values in AttributeCreate mutation

* Drop attribute unit validation in AttributeCreate mutation

* Update measurement units
…s-of-numeric-attributes

Allow setting values of numeric attributes
…e-with-numeric-attribute

Add test for productVariantBulkCreate with numeric attribute
* Add possibility to filter product numeric attributes by range

* Drop value field from AttributeInput

* Add benchmark tests for filter attributes on products query
@IKarbowiak IKarbowiak self-assigned this Jan 26, 2021
@IKarbowiak IKarbowiak added feature branch attributes Issues related to improving the attributes/product types behavior labels Jan 26, 2021
@db-queries
Copy link

db-queries bot commented Jan 26, 2021

Here is the report for a1d5705 (mirumee:feature/numeric-attributes)
Base comparison is bad0aba.

Found 2 differences! (click me)

# saleor.graphql.accountbenchmark account
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  delete staff members                                       	         32	         32	              0
  query staff user                                           	         18	         18	              3
  staff create                                               	         22	         22	              3
  staff update groups and permissions                        	         32	         32	              4

# saleor.graphql.accountbenchmark permission group
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  permission group create                                    	         19	         19	              2
  permission group delete                                    	         20	         20	              3
  permission group query                                     	          7	          7	              0
  permission group update                                    	         33	         33	              1
  permission group update remove users with manage staff     	         27	         27	              3

# saleor.graphql.attributebenchmark attribute
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  query attribute                                            	          7	          7	              2
  query attributes                                           	         11	         11	              3

# saleor.graphql.checkoutbenchmark checkout mutations
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  add billing address to checkout                            	         49	         49	              5
  add shipping to checkout                                   	         63	         63	              9
  checkout email update                                      	         23	         23	              0
  checkout payment charge                                    	         39	         39	             14
  checkout shipping address update                           	         75	         75	             20
  checkout voucher code                                      	         67	         67	             10
  complete checkout                                          	        108	        108	             13
  complete checkout with single line                         	        110	        110	             13
  create checkout                                            	         73	         73	             11
  customer complete checkout                                 	        153	        153	             41
  update checkout lines                                      	         85	         85	             11

# saleor.graphql.checkoutbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  user checkout details                                      	         39	         39	              2

# saleor.graphql.discountbenchmark sales
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  sales query with channel slug                              	         16	         16	              0
  sales query withot channel slug                            	         15	         15	              0

# saleor.graphql.discountbenchmark vouchers
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  vouchers query with channel slug                           	         16	         16	              0
  vouchers query withot channel slug                         	         15	         15	              0

# saleor.graphql.orderbenchmark fulfillment refund and return products
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  fulfillment refund products order lines                    	         54	         54	              3
  fulfillment return products order lines                    	        104	        104	             13

# saleor.graphql.orderbenchmark order
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  staff multiple orders                                      	         25	         25	              0
  staff order details                                        	         77	         77	             43
  user order details                                         	         33	         33	              3

# saleor.graphql.pagebenchmark page type
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  query page type                                            	         17	         17	              5
  query page types                                           	         19	         19	              5

# saleor.graphql.productbenchmark category
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  categories children                                        	          3	          3	              0
  category delete                                            	         83	         83	             14
  category view                                              	         25	         25	              1

# saleor.graphql.productbenchmark collection
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  collection add products                                    	         32	         32	              5
  collection bulk delete                                     	         39	         39	              5
  collection view                                            	          6	          6	              0
  create collection                                          	         32	         32	              5
  delete collection                                          	         34	         34	              6
  remove products from collection                            	         29	         29	              5
  retrieve collection channel listings                       	          4	          4	              0

# saleor.graphql.productbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  report product sales                                       	         10	         10	              3
  retrieve product list                                      	          4	          4	              0

# saleor.graphql.productbenchmark product
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
+ filter products by attributes                              	          -	          8	              0
+ filter products by numeric attributes                      	          -	         17	              0
  product create                                             	         68	         68	              3
  product details                                            	         30	         30	              0
  retrieve channel listings                                  	         18	         18	              0
  retrieve product attributes                                	          8	          8	              0
  retrieve product images                                    	          3	          3	              0
  retrieve product media                                     	          3	          3	              0
  retrive products with product types and attributes         	          6	          6	              0
  update product                                             	         33	         33	              3

# saleor.graphql.productbenchmark product variant channel listing update
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  variant channel listing update                             	         48	         48	              4

# saleor.graphql.productbenchmark variant
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  product variant bulk create                                	         62	         62	              2
  product variant create                                     	         74	         74	              6
  retrieve variant list                                      	         24	         24	              0
  update product variant                                     	         76	         76	             10

# saleor.graphql.productbenchmark variant stocks
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  product variants stocks create                             	         22	         22	              5
  product variants stocks delete                             	         19	         19	              5
  product variants stocks update                             	         27	         27	              5
  query product variants stocks                              	         14	         14	              4

# saleor.graphql.producttest product sorting attributes
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  sort product not having attribute data                     	         23	         23	              0

# saleor.graphql.shippingbenchmark shipping methods
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  vouchers query with channel slug                           	         10	         10	              0
  vouchers query without channel slug                        	          9	          9	              0

# saleor.graphql.shopbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  retrieve shop                                              	          6	          6	              0

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #6790 (a1d5705) into master (bad0aba) will increase coverage by 0.01%.
The diff coverage is 97.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6790      +/-   ##
==========================================
+ Coverage   93.31%   93.33%   +0.01%     
==========================================
  Files         455      456       +1     
  Lines       33480    33605     +125     
  Branches     3412     3425      +13     
==========================================
+ Hits        31243    31364     +121     
- Misses       1552     1553       +1     
- Partials      685      688       +3     
Impacted Files Coverage Δ
saleor/core/weight.py 100.00% <ø> (ø)
saleor/csv/utils/__init__.py 100.00% <ø> (ø)
saleor/csv/tests/export/products_data/utils.py 93.42% <75.00%> (-1.03%) ⬇️
saleor/graphql/product/filters.py 92.46% <91.42%> (-0.53%) ⬇️
saleor/graphql/attribute/utils.py 93.22% <97.43%> (+0.49%) ⬆️
saleor/attribute/__init__.py 100.00% <100.00%> (ø)
saleor/attribute/models/base.py 89.68% <100.00%> (+0.16%) ⬆️
saleor/core/units.py 100.00% <100.00%> (ø)
saleor/csv/utils/products_data.py 100.00% <100.00%> (ø)
saleor/graphql/api.py 100.00% <100.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bad0aba...a1d5705. Read the comment docs.

@trevorlelsbree
Copy link

When will this feature be completed? Or released

saleor/graphql/schema.graphql Show resolved Hide resolved
IKarbowiak and others added 5 commits April 13, 2021 14:00
…te-value-instead-of-creating-new-one

Update instance numeric attribute value instead of creating new value
…-unit-in-attribute-update-mutation

Update units and allow updating unit in attribute update mutation
@CLAassistant
Copy link

CLAassistant commented Apr 16, 2021

CLA assistant check
All committers have signed the CLA.

@maarcingebala maarcingebala merged commit a6ec463 into master Apr 29, 2021
@maarcingebala maarcingebala deleted the feature/numeric-attributes branch April 29, 2021 08:53
maarcingebala added a commit that referenced this pull request May 11, 2021
* Add numeric attribute input type (#6747)

* Add NUMERIC AttributeInputType

* Prepare units enum

* Add measurement units and unit field to attribute

* Allow defining unit in AttributeCreate mutation

* Add test for query numeric attribute and update test for getting variant selection attributes

* Add validation for numeric attribute values in AttributeCreate mutation

* Drop attribute unit validation in AttributeCreate mutation

* Update measurement units

* Move AttributeValueInput to attribute/types.py file

* Add validation for numeric attributes input

* Add test for defining numeric attribute values in product mutations

* Add tests for defining numeric attribute values in variant mutations

* Add utils method for checking if attribute value is required

* Allow exporting numeric attributes (#6755)

* Add test for productVariantBulkCreate with numeric attribute

* Add example numeric attribute to populate db (#6765)

* Allow filtering by numeric attributes (#6759)

* Add possibility to filter product numeric attributes by range

* Drop value field from AttributeInput

* Add benchmark tests for filter attributes on products query

* Update changelog

* Update instance numeric attribute value instead of creating new value

* Allow updating unit in attributeUpdate mutation

* Rename Volume OZ to FL_OZ unit

* Remove numeric attribute from variant selection

* Fix test for variant selection attributes

Co-authored-by: Marcin Gębala <5421321+maarcingebala@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attributes Issues related to improving the attributes/product types behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants