-
-
Notifications
You must be signed in to change notification settings - Fork 775
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 overage alert to advanced payout. #2386
Conversation
CC @pinkiebell, @thelostone-mc, @mbeacom, @SaptakS, @PixelantDesign for re-review. Thanks :). |
Codecov Report
@@ Coverage Diff @@
## master #2386 +/- ##
==========================================
- Coverage 29.29% 29.08% -0.22%
==========================================
Files 147 148 +1
Lines 11852 11928 +76
Branches 1602 1616 +14
==========================================
- Hits 3472 3469 -3
- Misses 8262 8341 +79
Partials 118 118
Continue to review full report at Codecov.
|
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.
Just pushed out fix. Codecov error is not due to this edit. Let me know if it's good to go :). |
Feel free to re-review when you have time! Thanks :). |
Although I've restructured the commits to include Because of that, simply changing the i variable to 0 would not work, since The only way to fix this issue was to append Of course, this might actually be a more complicated solution than simply not using I hope @SaptakS or you have some better idea at how to combat this, since this doesn't seem to be the easiest way to do this. Possibly my JS is just all over the place? |
Ah 😓 meh ! I'm good with what we have if that's the case
did now know about that 😅 |
@Anish-Agnihotri can't you just do |
Lol, I was completely overthinking myself. Thanks @SaptakS. I've pushed out the new (hopefully ready to merge, now) commit. I realized that there was a lot of over-engineering and removed the need for Do you think this is a better idea? |
var is_error = !$.isNumeric(amount) || amount <= 0 || username == '' || username == '@'; | ||
|
||
if (!is_error) { | ||
total += amount; | ||
} | ||
} | ||
}); | ||
|
||
return total; |
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.
@Anish-Agnihotri okay. Sorry but .each()
function won't be very helpful here because callback functions will be executed asynchronously, and hence when you return total outside, no guarantee that it will give the total.
Something like this will be good.
var rows = $('#payout_table tbody tr');
for (i = 0; i < rows.length; i += `) {
var $rows = $(rows[i]);
var amount = parseFloat($row.find('.amount').text());
// and all the other code
}
return total;
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.
Ah, yes, async execution. Thanks for the reviews, always a good learning experience. Pushing it out according to your recommendation now.
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.
@SaptakS @Anish-Agnihotri Hey guys, chiming in to clarify something.
Sorry but .each() function won't be very helpful here because callback functions will be executed asynchronously,
jQuery each
function is synchronous. You can verify this by adding a console.log(total)
after the each
function call. You can also refer to this SO thread for more information.
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.
Left some comments 👍
@thelostone-mc
What is the status of the Payout Preview paid and net values mentioned in the description?
(Want to try that out locally ;))
padding-left: 15px; | ||
} | ||
|
||
.overageAlert>div:first-child { |
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.
Cosmetic / Space to breath 😄
.overageAlert > div:first-child
padding-right: 10px; | ||
} | ||
|
||
.overageAlert>div:last-child { |
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.
Same ^
padding-top: 6.5px; | ||
} | ||
|
||
.overageAlert>div:first-child>img { |
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.
Same ^
@@ -162,7 +162,7 @@ $(document).ready(function($) { | |||
<tr> | |||
<td class="pl-0 pb-0"> | |||
<div class="pl-0"> | |||
<select id="username" onchange="update_registry()" class="username-search custom-select" style="width: 100%; margin-left: auto; margin-right: auto;"></select> | |||
<select onchange="update_registry()" class="username-search custom-select" style="width: 100%; margin-left: auto; margin-right: auto;"></select> |
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.
Add w-100 ml-auto mr-auto
to the class attribute and we can get rid of the style=...
attribute. :)
var $row = $('#payout_table tobdy').find('tr:nth-child(' + i + ')'); | ||
var amount = parseFloat($row.find('.amount').text()); | ||
var username = $row.find('.username-search').text(); | ||
for (i = 0; i < rows.length; i += 1) { |
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 we want to use let / ES5/6 style ? cc @thelostone-mc @SaptakS
Like:
for (let i = 1; i < num_rows; i++) {
let row = rows[i]; // XXX: Do we need $(rows[i])?
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.
I think Gitcoin is moving towards ES6 styling if I remember correctly, so I'd be glad to switch these over.
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.
It's okay for now. We will anyways do a complete migration from old-school to ES6 soon.
Thanks @pinkiebell for the review 🙌 ! Just pushed out new commit. Anish |
Thanks @pinkiebell! |
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.
code looks lgtm ! @SaptakS good for merge ?
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.
LGTM
🎉 Perfect! We should be good for merge then :) |
Description
This PR resolves #2294 by introducing:
See it in action! Before new changes.
A lot of the changes that were made in the last PR were addressed by @thelostone-mc in his PR introducing user profiles. Thus, code that I had previously written for that purpose (removing users, bounty stake, etc.) has been removed from this revised PR.
Checklist
Affected core subsystem(s)
UI is the only core system affected, since all changes are aesthetic.
Testing
Tested across two environments across two platforms (W10, Mojave). Feel free to test yourself as well.
Currently, this PR is not functional since the Payout Preview paid and net values are broken (cc @thelostone-mc). Once that is functioning again this PR will be fully functional.
Refers/Fixes
Fixes #2294.