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

Records UserAction events for Tip, Start/Stop Work, and Bounty related things #664

Merged
merged 2 commits into from Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion app/assets/v2/js/pages/bounty_details.js
Expand Up @@ -194,7 +194,6 @@ var showWarningMessage = function(txid) {
clearInterval(interval);
var link_url = etherscan_tx_url(txid);

$('#pending_changes').attr('href', link_url);
$('#transaction_url').attr('href', link_url);
}

Expand Down
10 changes: 5 additions & 5 deletions app/dashboard/helpers.py
Expand Up @@ -452,12 +452,11 @@ def process_bounty_details(bounty_details):

def record_user_action(event_name, old_bounty, new_bounty):
user_profile = None
fulfillment = None
try:
if event_name in ['new_bounty', 'killed_bounty', 'work_done']:
user_profile = get_profile(new_bounty.bounty_owner_github_username)
if event_name in ['work_submitted']:
fulfillment = new_bounty.fulfillments.order_by('pk').first()
user_profile = get_profile(fulfiller_github_username)
user_profile = Profile.objects.filter(handle__iexact=new_bounty.bounty_owner_github_username).first()
fulfillment = new_bounty.fulfillments.order_by('pk').first()

except Exception as e:
logging.error(f'{e} during record_user_action for {new_bounty}')
# TODO: create a profile if one does not exist already?
Expand All @@ -469,6 +468,7 @@ def record_user_action(event_name, old_bounty, new_bounty):
metadata={
'new_bounty': new_bounty.pk if new_bounty else None,
'old_bounty': old_bounty.pk if old_bounty else None,
'fulfillment': fulfillment,
Copy link
Contributor

Choose a reason for hiding this comment

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

},
)

Expand Down
3 changes: 0 additions & 3 deletions app/dashboard/templates/bounty_details.html
Expand Up @@ -23,9 +23,6 @@
<div style='width:100%; font-size: 16px;'>
<strong style="font-size: 22px;">Your transaction has been posted to web3</strong>
<br>
This funded issue has recently been updated and while the blockchain syncs it has
<a target="_blank" href="javascript:void(0)" id="pending_changes">pending changes</a>.
<br>
Please wait a minute or two for web3 to sync
<a target="_blank" href="javascript:void(0)" id="transaction_url">this transaction</a>.
(You may close the browser tab. This page will automatically refresh as soon as the blockchain is updated.)
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/views.py
Expand Up @@ -70,7 +70,7 @@ def record_user_action(profile_handle, event_name, instance):
instance_class = instance.__class__.__name__.lower()

try:
user_profile = get_profile(profile_handle)
user_profile = Profile.objects.filter(handle__iexact=profile_handle).first()
UserAction.objects.create(
profile=user_profile,
action=event_name,
Expand Down