Skip to content

Commit

Permalink
Bugfix - nearbeach-1064 RFC - Change LEAD not showing correct profile…
Browse files Browse the repository at this point in the history
… picture
  • Loading branch information
Luke Clarke committed Aug 10, 2023
1 parent c619542 commit a326dfa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 7 additions & 2 deletions NearBeach/views/request_for_change_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
RequestForChangeGroupApproval,
ListOfRFCStatus,
)
from django.db.models import Q
from django.db.models import Q, F
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse
from django.urls import reverse
from django.template import loader
Expand Down Expand Up @@ -67,12 +67,17 @@ def get_rfc_context(rfc_id):
"""
# Get data
rfc_results = RequestForChange.objects.get(rfc_id=rfc_id)
rfc_change_lead = User.objects.filter(id=rfc_results.rfc_lead.id).values(
rfc_change_lead = User.objects.filter(
id=rfc_results.rfc_lead.id
).annotate(
profile_picture=F('userprofilepicture__document_id__document_key')
).values(
"id",
"email",
"first_name",
"last_name",
"username",
"profile_picture",
)
user_list = User.objects.filter(
is_active=True,
Expand Down
10 changes: 9 additions & 1 deletion src/js/components/request_for_change/RfcInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<tr>
<td>
<img
v-bind:src="`${staticUrl}/NearBeach/images/placeholder/people_tax.svg`"
v-bind:src="getProfilePicture(rfcChangeLead[0].profile_picture)"
alt="default profile"
class="default-user-profile"
/>
Expand Down Expand Up @@ -431,6 +431,14 @@
//Send data
this.sendUpdate(data_to_send);
},
getProfilePicture(profile_picture) {
//If customer profile is blank - return default picture
if (profile_picture === "" || profile_picture === null || profile_picture === undefined) {
return `${this.staticUrl}/NearBeach/images/placeholder/product_tour.svg`;
}
return `${this.rootUrl}private/${profile_picture}`;
},
getStatus() {
return this.rfcStatusDict[this.rfcResults[0].fields.rfc_status];
},
Expand Down

0 comments on commit a326dfa

Please sign in to comment.