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

adding increase / decrease functions #103

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RawanAbuleil
Copy link
Contributor

@RawanAbuleil RawanAbuleil commented Jan 17, 2023

****This PR is based on PR no. 91 , once it's merged will update

  1. two view functions created :

    • increase quantity : which increases the product quantity by one when pressing on the + button from the supplier html page
    • decrease quantity: lowers the products quantity by one when pressing on the + button from the supplier html page
  2. one test has been created for each function .

  3. added two buttons to the supplier html file
    closed create increase / decrease functions  #104

templates/supplier/suppliers.html Outdated Show resolved Hide resolved
supplier_product/views.py Outdated Show resolved Hide resolved
supplier_product/views.py Outdated Show resolved Hide resolved
supplier_product/views.py Outdated Show resolved Hide resolved
supplier_product/views.py Outdated Show resolved Hide resolved
supplier_product/test_views.py Outdated Show resolved Hide resolved
supplier_product/test_views.py Outdated Show resolved Hide resolved
supplier_product/test_views.py Outdated Show resolved Hide resolved


def increase_quantity(request, id):
SupplierProduct.objects.filter(supplier_product_id=id).update(quantity=F('quantity')+1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you use this since you have increase method in the supplierproduct

def decrease_quantity(request, id):
product = SupplierProduct.objects.get(supplier_product_id=id)
if product.quantity > 0:
SupplierProduct.objects.filter(supplier_product_id=id).update(quantity=F('quantity')-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as increasing

@thetaxas2468
Copy link
Collaborator

  • Please squash extra commits like 1
  • Add images about the progress if you can

@pazMenachem
Copy link
Collaborator

pazMenachem commented Jan 17, 2023

@thetaxas2468
spot on with the comments, was thinking the same
thou, i will add that you could have rebased on my PR instead of copying the code.

Why would you use create method since there is save product method that is created
fixture from conftest.
no need to import it also, since its in the project file.

do tell if any help is needed.

@thetaxas2468
Copy link
Collaborator

  • Squash your commits 1 and last one and rebase on upstream/main since your first commit is merged
  • increase and decrease functions is on views but where do we use them in the front

@thetaxas2468 thetaxas2468 added the Ready for review PR is following the contribution guide and has the whole functionality and tests ready. label Jan 19, 2023
@Omeramsc
Copy link
Contributor

91 is merged, please rebase on top of main and possibly squash the commits, it'll make it much easier to review. I believe we would be able to merge it today as Karam provided a lot of good feedback.

Creating increase / decrease quantity views functions :
** this code depends on suppliers.html code which hasn't been merged yes once the code is merged i will change it **
two functions has been created : which increase and decrease the quantity of a product by it's supplier
 *** modifie the code so it increase / decrease the quantity by "n" not one
 *** no changes in the suppliers html file.
@thetaxas2468
Copy link
Collaborator

You have the same problem as lior had in his closed PR about linkedin,check it out(the problem is about your commit maybe you have done commit --amend at the start or you have squashed your commit with the merged commit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for review PR is following the contribution guide and has the whole functionality and tests ready.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create increase / decrease functions
5 participants