-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
Profile Not deleting Bug #3526
Profile Not deleting Bug #3526
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @heintayzar-hm thanks for the PR! I think there should be a way to solve this that doesn't involve putting sentinel strings into the database.
@@ -90,7 +90,7 @@ def profile_params | |||
:enable_individual_requests, | |||
:enable_quantity_based_requests, | |||
documents: [] | |||
).select { |_, v| v.present? } | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a reason this had to happen before... there was some error that was happening. I don't remember why. 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dorner , Yeah when I removed that I actually got the error from: #3446
reason that I removed
So the thing here is we check with v.present?
. So if there is no value, we are not getting any values from params and not updating and causing this bug.
possible error that you metioned
As for the error that you talked I think it is this one(but I am not very sure):
#3446
if we don't include v.present
it is updating files(previously) and getting the error.
I don't know whether I keep the current change or (I can compare the params data and database profile data and then update but this is the current way the only thing that changed is the place we filter things). Please let me know about this one, thank you/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe what we can do is instead of checking if the value is present, we check if the key is present in the parameters. That should allow us to save blank values. If that still doesn't work, maybe we handle file uploads separately.
app/models/partners/profile.rb
Outdated
@@ -106,7 +106,7 @@ class Profile < Base | |||
] | |||
|
|||
def has_no_social_media? | |||
website.blank? && twitter.blank? && facebook.blank? && instagram.blank? | |||
(website.blank? || website == "N/A") && (twitter.blank? || twitter == "N/A") && (facebook.blank? || facebook == "N/A") && (instagram.blank? || instagram == "N/A") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be forced to use "N/A" when an empty string also indicates that there is no value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will work on that
Hi, it is done. But for showing "N/A" on the profile. I have done it without storing the string in the database but it is affecting other test cases. So I didn't push on this branch. |
@heintayzar-hm I'm confused about how these 2 PRs are related. It seems like both of them fix the same problem, but this one is "incomplete" because it does it by using "N/A", which we said we didn't want to use? Can we combine these two into a single solution? |
@dorner ok, the reason I divided two prs is in this pr #3532, the changes that I made is affecting other test cases as I changed model getter methods. in this #3532, so I am making sure to include in this pr or not, by your final message, so should I discard the #3532 and did not include "N/A" part? |
@heintayzar-hm I'm not sure I fully understand your question. All I'm really looking for is something that fixes this issue without the additional baggage of an "N/A" sentinel value. If you have a solution for that, then it should be part of a single PR rather than split into two. |
@dorner , it is working and please review again this pr, previous there is a misunderstanding in my end , I am sorry. But Make sure to reset the database and seed it back cause there might be previous update,if there is a problem, please let me know 😄😄 |
@heintayzar-hm sorry, I'm still confused. The current PR is still setting values to "N/A" instead of blanks. |
Just to be sure, what you want is not setting anything, inside the input fields, not even the value "N/A". (The current pr does not store anything inside the database, I really thought you don't want to only add "N/A", in the database), So if it is tell me, because I think our communication was off 😐😐. |
Correct. When you save a blank field, it should set it to a blank string and that's what should show up on the front-end. |
In these changes, I removed the N/A showing in the frontend. @dorner |
end | ||
|
||
it "does not store N/A in the database" do | ||
expect(partner.profile.website).to be_nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, is there something that deliberately changes the value "N/A" to nil? If this test passes, I'm not sure why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, It was because I forgot to add reload, it should be partner.profile.reload.website
as I a use put
request in before
block. The caching is causing the problem. I will update with the changes.
Hi, I finished the testing part, but if you look at my latest commits(latest fours commits), I found that the |
@heintayzar-hm this looks good! |
Resolves #3428
Description
Type of change
In this Pr, I did the following:
When partners update their profile to an empty value, we will also change it into an "N/A" value(as said in the issue).
When the organization updates its profile to an empty value, we will also change it into an "N/A" value(as said in the issue).
How Has This Been Tested?
In this pr, I test the above functionalities with empty values.