-
Notifications
You must be signed in to change notification settings - Fork 1
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
Geoshapes from wikidata #29
base: master
Are you sure you want to change the base?
Conversation
ebe8c4f
to
332e730
Compare
332e730
to
ec32e36
Compare
ec32e36
to
1d8080b
Compare
1d8080b
to
122dfe8
Compare
122dfe8
to
8c642fa
Compare
This only works for electoral districts, it still needs a bit of untangling for the countries. |
8c642fa
to
3ff4d1e
Compare
Some feed back on 3ff4d1e would be helpful. The desired behaviour is to look for a geoshape if no p-c-repo exists, and not get stuck in a loop of endless geoshape fetches with each new save. I wonder if a similar etag solution would work here? |
I'd've hoped that if this were e.g.: boundary = instance.boundary = Boundary.objects.get(
set__slug=slug, external_id=instance.id
)
if instance.boundary != boundary:
instance.boundary = boundary
instance.save() Then it would only call For now, shall we just add a |
3ff4d1e
to
5444d67
Compare
3481d9f
to
bcfff18
Compare
5444d67
to
18a69ce
Compare
Codecov Report
@@ Coverage Diff @@
## master #29 +/- ##
=========================================
+ Coverage 69.31% 72.02% +2.7%
=========================================
Files 48 51 +3
Lines 1395 1537 +142
=========================================
+ Hits 967 1107 +140
- Misses 428 430 +2
Continue to review full report at Codecov.
|
18a69ce
to
46d3fdc
Compare
ed1c655
to
78f86a5
Compare
@celery.shared_task | ||
def refresh_legislature_list(country_id): | ||
country = models.Country.objects.get(id=country_id) | ||
def refresh_legislatures(id, queued_at): |
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.
Function refresh_legislatures
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
@celery.shared_task | ||
def refresh_legislature_members(legislature_id): | ||
house = models.LegislativeHouse.objects.get(id=legislature_id) | ||
def refresh_members(id, queued_at): |
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.
Function refresh_members
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
78f86a5
to
7a6dbbb
Compare
'sources': 'sources', | ||
'data': { | ||
'type': 'FeatureCollection', | ||
'features': [{ |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
Some tasks (e.g. `refresh_geoshape`) only need to happen on a particular subset of items. This change means that `with_periodic_queuing_task` will only queue tasks for items that meet a particular condition, specified though a `queryset_filter=lambda qs: qs.filter(…)` parameter when constructing the decorator.
7a6dbbb
to
e585e6e
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.
I've done some more work on this, so I'm passing the review on to Nick
No description provided.