Obsession-Boutique / Joannie-Store-Shop

E-Commerce Site for Boutique
https://obsessionboutique.herokuapp.com
1 stars 2 forks source link

Feature Implement #1

Closed AstroProjection closed 2 years ago

AstroProjection commented 3 years ago

Fixing the issue of Delete Product Review as discussed on https://github.com/bradtraversy/proshop_mern/issues/141

Please update your 'master' branch to your latest changes and push it to origin

talmax1124 commented 3 years ago

I don't see the PR

AstroProjection commented 3 years ago

Will do it, but I wanted to latest version of your main branch so that I can work off of that

talmax1124 commented 3 years ago

Ok, just commited my latest changes

AstroProjection commented 3 years ago

I don't have access to push to your repository

talmax1124 commented 3 years ago

Let me do that then

talmax1124 commented 3 years ago

Try now

AstroProjection commented 3 years ago

https://github.com/Obsession-Boutique/Joannie-Store-Shop/pull/2

Verify and let me know.

talmax1124 commented 3 years ago

It does nothing: [0] DELETE /api/products/6089626dcc7322a7134fa879/reviews 201 323.964 ms - 28

Once I click, the error does not show, but it does not delete. The thing above is the response from the terminal in VSCODE

@AstroProjection

talmax1124 commented 3 years ago
Screen Shot 2021-04-28 at 10 21 37 AM
AstroProjection commented 3 years ago

Could you send a pic of the payload that's being sent on the delete request as well as the headers which are being sent

talmax1124 commented 3 years ago
Screen Shot 2021-04-28 at 10 33 21 AM Screen Shot 2021-04-28 at 10 33 40 AM Screen Shot 2021-04-28 at 10 33 59 AM

![Uploading Screen Shot 2021-04-28 at 10.34.12 AM.png…]()

AstroProjection commented 3 years ago

Could you you send an screenshot of the payload, it should be the review data that we're sending from the frontend to the back

talmax1124 commented 3 years ago

Where do I find the payload?

talmax1124 commented 3 years ago

https://user-images.githubusercontent.com/61528430/116430124-89d23880-a814-11eb-9785-cd2bec2e59a0.mov

talmax1124 commented 3 years ago

Does this help? @AstroProjection Do you think we will have time to complete it today?

talmax1124 commented 3 years ago

@AstroProjection Once we finish this, the next thing I want to integrate is Options. I created a issue about this in the proshop repo as well

AstroProjection commented 3 years ago

https://github.com/Obsession-Boutique/Joannie-Store-Shop/pull/3 - this PR should resolve the issues

talmax1124 commented 3 years ago

Yes it is working now

talmax1124 commented 3 years ago

Ok, I implemented coupons. I think this may be a stupid fix, but when I do multiplication by 0.3 which is supposed to be 30% gives me a bunch of numbers after it. You know for example 3.2993448 when I have .toFixed(2). Any fixes you can think of?

talmax1124 commented 3 years ago

You want me to explain where and what I did?

AstroProjection commented 3 years ago

I'm not sure I understand the question, the float.toFixed(2) isn't working?

talmax1124 commented 3 years ago

Exactly. Ok, so I am using the files cartAction: export const addCoupon = (coupon) => (dispatch) => { let couponDiscount = 0;

// TODO: Get couponDiscount value from db

if (coupon.toLowerCase() === "familydiscount") { couponDiscount = 3; }

if (coupon.toLowerCase() === "militarydiscount") { couponDiscount = 2; }

if (coupon.toLowerCase() === "sacoleiraspecialty") { couponDiscount = 4; }

dispatch({ type: CART_ADD_COUPON, payload: { coupon, couponDiscount }, });

localStorage.setItem("coupon", JSON.stringify(coupon)); localStorage.setItem("couponDiscount", JSON.stringify(couponDiscount)); };

I added a coupon constant in the cart constant: export const CART_ADD_COUPON = "CART_ADD_COUPON";

Added to reducer: case CART_ADD_COUPON: return { ...state, coupon: action.payload.coupon, couponDiscount: action.payload.couponDiscount, };

and in placeorderscreen is:

if (cart.couponDiscount) { cart.totalPrice *= Number(cart.couponDiscount).toFixed(2); }

talmax1124 commented 3 years ago

The major component is in placeorderscreen. So I have the product price for example $7. Then the fee which is like $3.30. Then I get the value from the action and multiply by the cart total. When I add .toFixed(2) or even without toFixes(2) it does nothing. Doesn't constrain to two variables

AstroProjection commented 3 years ago

Add toFixed to the final cart.totalPrice

talmax1124 commented 3 years ago

I did this: if (cart.couponDiscount) { cart.totalPrice.toFixed(2) *= Number(cart.couponDiscount).toFixed(2); } and in terminal got: SyntaxError: /Users/carlitos/shop/frontend/src/screens/PlaceOrderScreen.js: Invalid left-hand side in assignment expression (75:4)

talmax1124 commented 3 years ago

I don't understand why this is doing it because everything is using .toFixed(2) in terms of the totalPrice and all that

AstroProjection commented 3 years ago
if (cart.couponDiscount) {
cart.totalPrice *= Number(cart.couponDiscount).toFixed(2);
cart.totalPrice = cart.totalPrice.toFixed(2);
}

You are multiplying the previous totalPrice with a new float value which will make it behave like that again

talmax1124 commented 3 years ago

Yay, it is working! Thanks. You have been so helpful

talmax1124 commented 3 years ago

I hate to keep bothering you but can we work on a vscode live share session. I started this feature but I was having multiple inputs and it was not passing to cartScreen. It's options

talmax1124 commented 3 years ago

I really appreciate everything you have done for me. I have been trying to get help from other people and all I gotten is I can't help you or I'm busy. So I appreciate you for helping me. It means alot. I know words may not mean a-lot, I would pay you if I had money. Honestly. As a 16 year old, I got into programming last year, and it has been a journey. A great one.

talmax1124 commented 3 years ago

I also found a bug in the reviews. It deleted the review, but when I'm seeing the word, it says 1 review when there is no review

Screen Shot 2021-04-28 at 11 24 59 PM

@AstroProjection

AstroProjection commented 3 years ago

Yeah sure, I can help you out, but i'm a bit busy during the day, it's 10AM where I live but in the evening I can try and help you out

talmax1124 commented 3 years ago

Ok, thanks! You really are a lifesaver. It's 12:17 in the night for me. But at the time you messaged me is fine

talmax1124 commented 3 years ago

Can you reply back here when you are available so I can come to this page. I get email notifications when someone replies. Thanks

talmax1124 commented 3 years ago

I think I am doing the calculations wrong, for the coupon I mean. I am getting the 30% of the total and not the total minus the 30%. Any fixes?

talmax1124 commented 3 years ago

Ok, I did this: if (cart.couponDiscount) { var tempDisc = Number(cart.couponDiscount) * cart.totalPrice cart.totalPrice -= tempDisc cart.totalPrice = cart.totalPrice.toFixed(2); }

You think this is efficient?

talmax1124 commented 3 years ago

Are you available now? @AstroProjection

talmax1124 commented 3 years ago

What time is it for you now?

AstroProjection commented 3 years ago

I think I am doing the calculations wrong, for the coupon I mean. I am getting the 30% of the total and not the total minus the 30%. Any fixes?

Total * 0.7 will give you the total after 30% discount

Ok, I did this: if (cart.couponDiscount) { var tempDisc = Number(cart.couponDiscount) * cart.totalPrice cart.totalPrice -= tempDisc cart.totalPrice = cart.totalPrice.toFixed(2); }

You think this is efficient?

It should be fine

It's 8:30, it's been a busy day

talmax1124 commented 3 years ago

I got that working!

On Thu, Apr 29, 2021 at 10:57 AM Akshay Hemant @.***> wrote:

I think I am doing the calculations wrong, for the coupon I mean. I am getting the 30% of the total and not the total minus the 30%. Any fixes?

Total * 0.7 will give you the total after 30% discount

Ok, I did this: if (cart.couponDiscount) { var tempDisc = Number(cart.couponDiscount) * cart.totalPrice cart.totalPrice -= tempDisc cart.totalPrice = cart.totalPrice.toFixed(2); }

You think this is efficient?

It should be fine

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Obsession-Boutique/Joannie-Store-Shop/issues/1#issuecomment-829308188, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVNS3S3GDCRJDRBMOXQR2DTLFXT5ANCNFSM43XDGABA .

talmax1124 commented 3 years ago

https://prod.liveshare.vsengsaas.visualstudio.com/join?79EF46F7F6DD3CA7348F4499315E061DF29C Here is my live share link

Can we continue chatting in discussions?

talmax1124 commented 3 years ago

It's 8:30, it's been a busy day

It's been a busy morning for me too!

@AstroProjection Discussion Link: https://github.com/Obsession-Boutique/Joannie-Store-Shop/discussions/5

talmax1124 commented 3 years ago

Good Morning to you! When will you be able to assist?

AstroProjection commented 3 years ago

Hey good morning, again busy during the day but ask your queries and if I can help i'll give you suggestions

talmax1124 commented 3 years ago

When are you going to be available to help in the programming process? This part I am really confused and have tried multiple times. The other things were things I had integrated in the backend but needed help in the frontend.

Whenever you can help me out like scope it out, I would appreciate it.

On Fri, Apr 30, 2021 at 12:17 AM Akshay Hemant @.***> wrote:

Hey good morning, again busy during the day but ask your queries and if I can help i'll give you suggestions

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Obsession-Boutique/Joannie-Store-Shop/issues/1#issuecomment-829793200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVNS3UCTKWNTBXEUU4C6PDTLIVM7ANCNFSM43XDGABA .

talmax1124 commented 3 years ago

The thing that I need your help with is adding options and qty in products. Sort of like this:

https://user-images.githubusercontent.com/61528430/116652632-98733980-a953-11eb-8e6f-148bdc797f37.mov

@AstroProjection

AstroProjection commented 3 years ago

Get started on it and I'll look into it later in the day, make a new branch from your master and make your changes on that

talmax1124 commented 3 years ago

ok

On Fri, Apr 30, 2021 at 1:34 AM Akshay Hemant @.***> wrote:

Get started on it and I'll look into it later in the day, make a new branch from your master and make your changes on that

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Obsession-Boutique/Joannie-Store-Shop/issues/1#issuecomment-829850525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVNS3RLMXRWO6YEHAOXR6DTLI6NRANCNFSM43XDGABA .

talmax1124 commented 3 years ago

I just pushed it to the branch that I created like you said Are you going to be available now? I updated the branch again. Can we continue in the discussions tab? @AstroProjection Is it 7pm for you? Can you see the new branch? I called it options @AstroProjection

AstroProjection commented 3 years ago

Hey, yea I see the branch, what are you trying to do?