-
-
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
Split create_new_bounty kwargs building and check if once #1892
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1892 +/- ##
==========================================
- Coverage 25.52% 25.51% -0.01%
==========================================
Files 130 130
Lines 10669 10683 +14
Branches 1420 1423 +3
==========================================
+ Hits 2723 2726 +3
- Misses 7868 7879 +11
Partials 78 78
Continue to review full report at Codecov.
|
privacy_preferences=bounty_payload.get('privacy_preferences', {}) if not latest_old_bounty else latest_old_bounty.privacy_preferences, | ||
expires_date=timezone.make_aware( | ||
timezone=UTC), | ||
'github_url': url, |
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 problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'network': bounty_details.get('network'), | ||
'bounty_type': metadata.get('bountyType', ''), | ||
'project_length': metadata.get('projectLength', ''), | ||
'experience_level': metadata.get('experienceLevel', ''), |
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.
oooh this is much cleaner... yay!
app/dashboard/models.py
Outdated
@@ -827,6 +827,41 @@ def additional_funding_summary_sentence(self): | |||
sentence += f" worth ${afs['usd_value']}" | |||
return sentence | |||
|
|||
def creation_to_dict(self): | |||
return { | |||
# info to xfr over from self as override fields (this is because sometimes |
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.
is there not a django object to dict() method that we could just use?
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's a django.forms
utility method to do this... I suppose I can use that.
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.
@owocki Updated to use django.form.models.model_to_dict
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.
👍 @mbeacom kevin owocki has sent you a 'boy scout' kudos for leaving this code better than you found it!
@thelostone-mc @owocki Can I have another review of this PR? I have introduced the |
}) | ||
else: | ||
latest_old_bounty_dict = latest_old_bounty.to_standard_dict( | ||
fields=[ |
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.
is fields
used here?
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.
oh wait nvm i see it 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.
didnt test, can you test a bounty end to end of rinkeby?
code LGTM
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
* 'master' of https://github.com/gitcoinco/web: (76 commits) hack: trailing slash for profile (gitcoinco#1937) Minor tweaks to action plan textarea (gitcoinco#1856) fixes label on gas guzzler page, and adds an admin view for vizuailzations keep an eye on unsubscribes in preferences keep an eye on unsubscribes in preferences Split create_new_bounty kwargs building and check if once (gitcoinco#1892) press satisfy linter fix for https://gitcoincore.slack.com/archives/CAXQ7PT60/p1533912000000126 Update profile check to getattr share link not edit link does tip receive math in BigNumber, bc JS rounding issues copy updates newsletter 8/10 fix for slack not showing UP gas guzzlers linter gas guzzlers Error: insufficient funds for gas * price + value starts to track gas guzzlers, for later inclusion in the gitcoin gas station ...
* put reasons above the other two modules * gitcoinco#1854 * css: minor refactor * token approvals * fix for email not being sent * retail: added template tag matches - matches tag does a regex match - updated nav to use matches to display network status on explorer, issue, bounty - create + submit + payout pages * code refactor + clean up - removed redundant uris - reindent code - fixed uneven padding of network banner on tip page * send2: convert CRLF -> LF * isort fixes * console error, responseJSON did not exist * change name of missing image * fix for exception in bounty.additional_funding_summary_sentence() * funder stale email * linter stinter * days * Fix linting issues and docstyle all teh thingz * Fix bad variable out of scope reference in render_bounty_startwork_expired email * restructure: landing - renamed index -> funder - moved funder related templates into it's own folder - added heading to top contributors * restructure: dashboard - renamed _dashboard -> dashboard - renamed dashboard.html -> dasboard/index.html * onboard: prettified metamask wallet address * Sentry integration (gitcoinco#1846) * Sentry integration - deprecate rollbar * Imports are hard * dbl quotez * Single quotes * Fix travis * Forgot to save this file xD * Add middleware and wsgi handler * Logging adjustments for Sentry * Fix gitcoinco#1898 - Adjust ordering of mailchimp args and cast envvars to str * Merge branch 'master' into restructure * gitcoinco@dead551#diff-8d7b20d795398cf2b0e792ee8c1a165c * space in sentence * Update presskit copy (gitcoinco#1900) * Fix sentry release script revision handling * add no a token page * disabled metamask * stickler hate me * add item to menu * dashboard: remove tech stack filter * fixes press kit * add no a token page * blank * Solve conflicts * sitemap fixes * disabled metamask * stickler hate me * i have grammar OCD * bad link * Fix gitcoin logo * documentation about chain of custody * cahin of custoyddyyyyyyyyyy * Modify raven handling * Add sentry request feedback on error * Extending expiration backend code added * Some minor changes * Adds cancel button * Adds alert notifying extending of expiration * Fixes linting issues * expiration: final touches - stickler fixes - show current expiration in modal - add stopwatch icon - extra css * Fixes travis * shared.js/mutate_interest: Show a generic message on network errors. followup 3960c6 PR gitcoinco#1681 * Round up millisecond position * Moderators v1 (gitcoinco#1903) * Ref gitcoinco#1669 - Base escalation/interest statuses and handling * Moderation changes * Add faucet change to perms * No mod * Fix mig for local * Update mod handling throughout remaining views and check gh closures * Whoops * Fix some tests * Fix some pytest cases * Fix more tests * indent fix * More test changes * Add property back to tips method * Fix gitcoinco#1919 - Catch attribute error if the keywords prop isn't a string * Adjust Raven JS to no longer load async * Revert "Adjust Raven JS to no longer load async" This reverts commit 37d4584. * Fix funding/details path * Adjust github details field * gh dict * catch on gh details * Remove temporarily * Disable url dict * Disable GH funcs * Display project length in issue details page * Fix GH token usage * translation tags and clarification on lcoalhost * facebook verify * facebook verify * Revert "facebook verify" This reverts commit 50b7ebb. * Revert "facebook verify" This reverts commit 51f5e54. * Adjust saving of gh issue details * sync geth stopgap fix * Adjust default limit on bounty router * Revert "Adjust default limit on bounty router" This reverts commit a7d872c. * stopgap fix * fixes * runs make fix on master branhc * sync mail fix to make it less aggressive * Adjust yapf to no longer touch settings.py * Update precommit yapf config * fix for sync_listener * linting sync_geth * copy updates * merge migration * Adjust gh state checks * Update gh state * Updates to gh pulling... * GH Pulling adjustments * meta tags * title * no ico life * conflicts * fix for https://gitcoincore.slack.com/archives/CC24APWGN/p1533245102000397 * prod bug * prod bug * prod bug * prod bug * graphs r fun * fix for not being able to ERC20 approve tokens * fix for leaderboards * eslint * adjusts hourly rate distribution calculation criteria * Switching tree section * landing: css + refactor * lander video switcharooooooooooooO * joe dominance was busttedd * shared: updated what_is_gitcoin * added branding style to terms page * changed style of headers on terms page, moved terms.txt into terms.html, added blocktrans tag * Confirming Auto-translation (gitcoinco#1916) * Update makefile with build/push/login and add OCI compliant labels * terms: moved to internal css + mt-4 -> mt-5 * Adjust sentry to use split projects * Fix config * Adjust fe sentry template * Sentry adjustments * livestream 8/3 * Sentry adjustments * livestream 8/3 (gitcoinco#1930) * Show Just 1 Alert Banner for ERC20 Token Fixes gitcoinco#1566 * allow trailing slah for profile (gitcoinco#1931) * Improve tip slack notification (gitcoinco#1929) * Improve tip slack notification * Remove title var and simply check tip.github_url * Add new lines * Adjust sentry raven JS * Adjust sentry raven JS * Revert profile url change * Revert "Adjust sentry raven JS" This reverts commit 5432bc4. * Revert "Adjust sentry raven JS" This reverts commit 25e9987. * Sentry adjustments * Final sentry js adjustments! * tip receive is eth * nonce value * bounty: restructure pages * Fix gitcoinco#1949 - Adjust getattr for profile * prod debugging; dupe emails * prod debugging of dupe emails * prod debugging of dupe emails * remove dupe to_email * dupe email fix * dupe email fix * dupe email fix * reverts debug code * fix for bad preferred profile addresses * fix for https://sentry.gitcoin.co/gitcoin/gitcoin-prod-frontend/issues/278/ * http 404 on hidden prfiles * SEO fixes, linting * content type for robots.txt * SEO stuff * sync_geth latest disabler * Fix isort / travis * what_is_gitcoin : revert to old design (gitcoinco#1957) * fix gitcoinco#1921 * Fix gitcoinco#1934 - Resolve funded total in profile (gitcoinco#1935) * fix for https://sentry.gitcoin.co/gitcoin/gitcoin-prod-backend/issues/321/?referrer=slack * support for https://sentry.gitcoin.co/gitcoin/gitcoin-prod-backend/issues/320/?referrer=slack * disqus url now canonical * funder stale args * very small copy change * smarter funder stale emails * fix for ipfs hashes not existing * fix for being redirected to old bounty id upon submission * copy updates * handler for not sending funder stale emails if n email * puts the right network linkn on the web3 waiter * metamask reloader * explorer: ensure results from latest api call are served to the user (gitcoinco#1941) * explorer: abort pending request for fetchingBounties * added review feedback * Upgrade django to 2.1, modify field defaults, and address deprecations (gitcoinco#1915) * Upgrade django to 2.1 and address deprecations * Remove commented out imports * fix: sticker issue * Update reqs * Remove unused import * Fix gitcoinco#1972 - Strip characters from stdbounties_id and check isdigit * replaced misspelled 'deonomination' with 'denomination' throughout the codebase (gitcoinco#1974) * dashboard: uri cleanup (gitcoinco#1971) * img: removed unused images * Resolve outdated deps in package-lock.json * Upgrade FE npm deps * Upgrade FE npm deps * Pin raven * starts to track gas guzzlers, for later inclusion in the gitcoin gas station * Error: insufficient funds for gas * price + value * gas guzzlers * linter * gas guzzlers * fix for slack not showing UP * newsletter 8/10 * copy updates * does tip receive math in BigNumber, bc JS rounding issues * share link not edit link * Update profile check to getattr * fix for https://gitcoincore.slack.com/archives/CAXQ7PT60/p1533912000000126 * satisfy linter * press * Split create_new_bounty kwargs building and check if once (gitcoinco#1892) * Split create_new_bounty kwargs building and check if once * Update to_dict to use model_to_dict form helper * Fix import - whoops * Adjust to dict handling via supermodel method * keep an eye on unsubscribes in preferences * keep an eye on unsubscribes in preferences * fixes label on gas guzzler page, and adds an admin view for vizuailzations * Minor tweaks to action plan textarea (gitcoinco#1856) * Clear example action plan when the textarea is focused * Fix minor typo * hack: trailing slash for profile (gitcoinco#1937) * start work : update placeholder * added feedback
Description
The goal of this PR is to reduce the number of checks whether or not
latest_old_bounty
exists and offload thelast_old_bounty
to a class level method for pertinent dict keys/values.Checklist
Affected core subsystem(s)
bounty creation/updating
Testing
Locally via sync_geth