-
Notifications
You must be signed in to change notification settings - Fork 32
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
Feature/new person page #660
Feature/new person page #660
Conversation
c2ab970
to
7690876
Compare
07aa2d5
to
3a24525
Compare
16d2b69
to
67d9f95
Compare
If you wanted a hand writing any unit tests for your model methods, I'd be happy to pair on it with you! |
c690ad2
to
b089459
Compare
18e1906
to
da66f08
Compare
@property | ||
def facebook_personal_username(self): | ||
facebook_personal_url = self.facebook_personal_url | ||
facebook_split = list(filter(None, facebook_personal_url.split("/"))) |
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.
With all these properties:
First, I wonder if there's a way to DRY up the methods a little - like pulling the main logic in to one place?
Second, parsing URLs is (or can be) hard - for example, we don't know that someone hadn't added a querystring to the end of a given URL that might look odd.
Here's an example from the actual data:
https://www.facebook.com/sarahmurraylibdem?notif_id=1523864067803194¬if_t=page_invite_accept&ref=notif
.
I think this code would reduce this down to:
sarahmurraylibdem?notif_id=1523864067803194¬if_t=page_invite_accept&ref=notif
.
A better option might be to use Python's build in URL parsing:
from urllib.parse import urlparse
parsed_url = urlparse('https://www.facebook.com/sarahmurraylibdem?notif_id=1523864067803194¬if_t=page_invite_accept&ref=notif')
Now parsed_url.path
would be sarahmurraylibdem
but might also contain more path elements, so we'd want to then do `url = parsed_url.path.split("/")[0].
Of course the real solution here is to get the screen name from the 3rd party site itself, but that's a problem for another day!
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.
Absolutely. I'll put this on my 'things to refactor' list. 👍
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.
Punting this to an issue as suggested so we can get this reviewed and rolled out faster.
Happy with where this is now - feel free to punt the URL parsing to an issue - I'll leave that one up to you to decide 👍 |
Just jumping in to say these look brilliant! My only thought is on the photo cropping, have you tested this with candidates who have a particularly low-res picture, or headshots in profile? This is a small number of images and will probably encourage us to find better photos, but thought I'd mention it. |
Do you have a lo-res candidate image in mind so I can test it? |
Yes, sorry, I couldn't come up with any immediately. Here are a couple of awkward examples from upcoming elections: |
What do you think? Next question I have is why the logic is rendering with 0 elections. 🤔 |
Good stuff! No significant difference from now, then (in terms of picture quality). |
539427d
to
6ec8bd9
Compare
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.
@pmk01 are you happy with this language?
Yes - how does it work with Mayors & PCCs? |
Here's a good candidate to try it on: |
Happy to send the entire page; not sure if you just wanted to see Previous elections for https://candidates.democracyclub.org.uk/person/6023/george-jabbour |
Sorry to jump in again, but for the "vote count not available" message on the table: we might have details about if they were elected or not, even if we don't have votes cast. For example, we'll have all general election results in terms of "elected: y/n". Another thing to punt to an issue, but we should show that if we have it. I think |
bcb3285
to
0876827
Compare
Further on results, do we want to add (not elected)? What do you guys think? That table also reveals a number of problems with the names of our historic elections, especially Mayor of Watford, but I don't think any of that relates to this change. Something to return to after May, I think. |
I think this is what you're referring to @symroe ? I've included an |
0876827
to
077ddb7
Compare
wcivf/apps/people/templates/people/includes/_person_previous_elections_card.html
Outdated
Show resolved
Hide resolved
@VirginiaDooley The photo cropping issue is due to |
@VirginiaDooley I'd have to see the markup, but we should be able to avoid this weird styling if the |
@Heydon https://github.com/DemocracyClub/WhoCanIVoteFor/pull/660/files#diff-ae321f98dbcc359e064a2026d2dbbbefa7fc149669e954b138a7aee7ab749005 |
@VirginiaDooley Okay, it seems you have a Note the use of
|
Just following up, have you captured this somewhere already? If not I can make an issue. |
<td>{{ person_post.post.label }}: {{ person_post.election }}</td> | ||
<td>{{ person_post.party.party_name }}</td> | ||
{% if person_post.elected %} | ||
<td>{% if person_post.votes_cast %}{{ person_post.votes_cast|intcomma }} votes (elected){% else %}Vote count not available{% endif %}</td> |
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.
So I think in the else
here, we would want to say "Elected" rather than "Vote count not available"? Because we know they were elected (from the check on line 24) we just don't know how many votes they got
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.
Yes, now that I think about it, maybe we want to say both where the vote count is not available.
wcivf/apps/people/templates/people/includes/_person_about_card.html
Outdated
Show resolved
Hide resolved
wcivf/apps/people/templates/people/includes/_person_about_card.html
Outdated
Show resolved
Hide resolved
81ed4d1
to
c9dc066
Compare
8f16fe5
to
8f1672a
Compare
This work implements the new DC design system for the candidate (Person) page as well as addresses the following:
*Related issues:
* #211
* #599
* #202
* #198
* #404
To install the new DC design system as a python package and test the changes in this PR, follow these instructions.
Note on testing:
Some conditionals in the template require us to create new factories and we weren't sure those sections (such as CV) would be made live just yet. Once the invalid template setting PR is merged, which is dependent on the DC base theme, it will catch conditionals we haven't explicitly tested here.
New design system screenshots
Intro Card for candidate with more than one current candidacy
Policies Card with expanded long (>100 words) statement to voters for long statements
Shorter statement to voters
About card (includes when present: wikipedia, CV, TWFY link)
Contact card
Previous elections Table