diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 5616cdc010f..6616e7afd71 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -1,80 +1,58 @@ let popoverData = []; const renderPopOverData = json => { - return ` -
-
-

${ - json.profile.handle -}

- Specialty: ${json.profile.keywords - .slice(0, 3) - .toString()} - ${Object.keys(json.profile.organizations).map( - (org, index) => { - if (index < 3) { - `${org}`; - } else { - ``; - } + let orgs = Object.keys(json.profile.organizations).map((org, index) => { + if (index < 3) { + return `${org}`; } - )} -
- ~ ${ - Number(json.profile.total_earned).toFixed(4) -} ETH earned -
-
- #${ - json.profile.position -} -

Gitcoin Contributor

-
-
-
- ${ - json.statistics.work_completed -} -

Bounties Completed

-
-
- ${ - json.statistics.work_in_progress -} -

Bounties In Progress

-
-
- ${ - json.statistics.work_abandoned -} -

Bounties Abandoned

-
-
- ${ - json.statistics.work_removed -} -

Bounties Removed

-
-
-
-
+ return `+${Object.keys(json.profile.organizations).length - 3}`; + }).join(' '); + + return ` +
+
+ +

${json.profile.handle}

+ Specialty: ${json.profile.keywords.slice(0, 3).toString()} + ${orgs.length ? 'Contributes to: ' + orgs : ''} +
+ ~ ${Number(json.profile.total_earned).toFixed(4)} ETH earned +
+
+ #${json.profile.position} +

Gitcoin Contributor

+
+
+
+ ${json.statistics.work_completed} +

Bounties Completed

+
+
+ ${json.statistics.work_in_progress} +

Bounties In Progress

+
+
+ ${json.statistics.work_abandoned} +

Bounties Abandoned

+
+
+ ${json.statistics.work_removed} +

Bounties Removed

+
+
+
+
- `; + + `; }; const openContributorPopOver = (contributor, element) => { diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 933b78dfee3..4aeabb12697 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -2365,6 +2365,17 @@ def is_staff(self): """ return self.user.is_staff if self.user else False + @property + def success_rate(self): + network = self.get_network() + num_completed_bounties = self.bounties.filter( + idx_status__in=['done'], network=network).count() + terminal_state_bounties = self.bounties.filter( + idx_status__in=Bounty.TERMINAL_STATUSES, network=network).count() + if terminal_state_bounties == 0: + return 1.0 + return num_completed_bounties * 1.0 / (terminal_state_bounties + num_completed_bounties) + @property def get_quarterly_stats(self): """Generate last 90 days stats for this user. diff --git a/app/dashboard/templates/bounty/details.html b/app/dashboard/templates/bounty/details.html index 0c362c98319..297ffead966 100644 --- a/app/dashboard/templates/bounty/details.html +++ b/app/dashboard/templates/bounty/details.html @@ -260,7 +260,7 @@
{% trans "Funder" %}
- + [[:name]]
@@ -485,8 +485,8 @@

{{ noscript.keywords }}

diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 014390ea970..ce6be98e6e8 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -1803,10 +1803,11 @@ def profile_details(request, handle): response = { 'profile': ProfileSerializer(profile).data, + 'success_rate': profile.success_rate, 'recent_activity': { 'activity_metadata': activity.metadata, 'activity_type': activity.activity_type, - 'created': activity.created, + 'created': activity.created }, 'statistics': { 'work_completed': count_work_completed,