Commit 0f93fb46 authored by Nicolas Joyard's avatar Nicolas Joyard Committed by Nicolas Joyard
Browse files

Use django_perf_rec for db queries and cache

parent 50fe62c7
......@@ -17,12 +17,13 @@ setup(name='political-memory',
'django-coffeescript>=0.7,<0.8',
'django-compressor>=1,<2',
'django-datetime-widget>=0.9,<1.0',
'django-filter>=0.13,<0.14',
'django-filter>=0.15,<0.16',
'django-fontawesome>=0.2,<0.3',
'django-perf-rec>=1.1.1,<2',
'django-rql-filter>=0.1.3,<0.2',
'django-taggit>=0.17,<0.18',
'django>=1.8,<1.9',
'djangorestframework>=3,<4',
'djangorestframework>=3,<3.5.1',
'hamlpy>=0.82,<0.83',
'ijson>=2.2,<2.3',
'python-dateutil>=2.4,<2.5',
......@@ -39,8 +40,8 @@ setup(name='political-memory',
'flake8>=2,<3',
'django-responsediff>=0.7,<0.8',
'pep8>=1,<2',
'pytest>=2,<3',
'pytest-django>=2,<3',
'pytest>=3,<4',
'pytest-django>=3,<4',
'pytest-cov>=2,<3',
'mock==2.0.0',
'tox>=2.3,<3',
......
from django.test import TestCase
# Create your tests here.
from django_perf_rec import record
class BaseTest(TestCase):
def record_performance(self):
return record(path='perf_records/')
......@@ -213,6 +213,15 @@ LOGGING = {
},
}
#
# django-perf-rec
#
PERF_REC = {
# Fail on missing records
'MODE': 'all'
}
###############################################################################
#
# Local settings
......
from django import test
from core.tests import BaseTest as CoreBaseTest
from responsediff.test import ResponseDiffTestMixin
from memopol_scores.models import RepresentativeScore
class BaseTest(ResponseDiffTestMixin, test.TestCase):
class BaseTest(ResponseDiffTestMixin, CoreBaseTest):
fixtures = ['data_sample.json']
"""
Common queries
- 1 for settings
"""
left_pane_queries = 1
def setUp(self):
RepresentativeScore.refresh()
......@@ -27,24 +21,6 @@ class RepresentativeBaseTest(BaseTest):
tab = 'none'
base_url = '/representatives/olivier-dussopt-1978-08-16/%s/'
"""
Common queries plus:
- 1 for session key
- 1 for chamber abbreviations (helper for chamber websites)
- 1 for the representative
- 1 for the main mandate
- 1 for emails
- 1 for social websites
- 1 for chamber websites
- 1 for other websites
- 1 for addresses
- 2 for phone numbers related to addresses
- 1 for other phone numbers
- 2 for themes and theme scores
- 1 for DAL to fetch its initial value in the position form
"""
queries = BaseTest.left_pane_queries + 15
@property
def url(self):
return self.base_url % self.tab
......@@ -53,7 +29,7 @@ class RepresentativeBaseTest(BaseTest):
# First query to set session variables
self.client.get(self.url)
with self.assertNumQueries(self.queries):
with self.record_performance():
self.client.get(self.url)
......@@ -61,13 +37,6 @@ class ThemeBaseTest(BaseTest):
tab = 'none'
base_url = '/themes/etat-durgence/%s/'
"""
Common queries plus:
- 1 for the theme
- 1 for DAL to fetch its initial value in the position form
"""
queries = BaseTest.left_pane_queries + 2
@property
def url(self):
return self.base_url % self.tab
......@@ -76,7 +45,7 @@ class ThemeBaseTest(BaseTest):
# First query to set session variables
self.client.get(self.url)
with self.assertNumQueries(self.queries):
with self.record_performance():
self.client.get(self.url)
......@@ -84,13 +53,6 @@ class DossierBaseTest(BaseTest):
tab = 'none'
base_url = '/dossiers/15409/%s/'
"""
Common queries plus:
- 1 for the dossier
- 1 for related themes
"""
queries = BaseTest.left_pane_queries + 2
@property
def url(self):
return self.base_url % self.tab
......@@ -99,5 +61,5 @@ class DossierBaseTest(BaseTest):
# First query to set session variables
self.client.get(self.url)
with self.assertNumQueries(self.queries):
with self.record_performance():
self.client.get(self.url)
ChartViewsTest.test_chamber_score_queries:
- db: 'SELECT ... FROM "representatives_chamber" WHERE "representatives_chamber"."id" = #'
- db: 'SELECT DISTINCT ... FROM "representatives_representative" INNER JOIN "representatives_mandate" ON ( "representatives_representative"."id" = "representatives_mandate"."representative_id" ) INNER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE (("representatives_mandate"."end_date" >= #::date OR "representatives_mandate"."end_date" IS #) AND "representatives_group"."chamber_id" = #) ORDER BY "memopol_scores_representativescore"."score" ASC'
ChartViewsTest.test_theme_score_queries:
- db: 'SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" = #'
- db: 'SELECT "memopol_scores_themescore"."score" FROM "memopol_scores_themescore" WHERE "memopol_scores_themescore"."theme_id" = # ORDER BY "memopol_scores_themescore"."score" ASC'
DossierDetailTest.test_queries:
- db: 'SELECT ... FROM "representatives_votes_dossier" WHERE "representatives_votes_dossier"."id" = #'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (#)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
DossierDocumentsTest.test_queries:
- db: 'SELECT ... FROM "representatives_votes_dossier" WHERE "representatives_votes_dossier"."id" = #'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (#)
- db: SELECT ... FROM "representatives_votes_document" WHERE "representatives_votes_document"."dossier_id" IN (#)
- db: SELECT ... FROM "representatives_chamber" WHERE "representatives_chamber"."id" IN (#)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
DossierListTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT COUNT(*) FROM (SELECT ... FROM "representatives_votes_dossier" LEFT OUTER JOIN "representatives_votes_proposal" ON ( "representatives_votes_dossier"."id" = "representatives_votes_proposal"."dossier_id" ) LEFT OUTER JOIN "representatives_votes_document" ON ( "representatives_votes_dossier"."id" = "representatives_votes_document"."dossier_id" ) LEFT OUTER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) GROUP BY "representatives_votes_dossier"."id") subquery
- db: 'SELECT ... FROM "representatives_votes_dossier" LEFT OUTER JOIN "representatives_votes_proposal" ON ( "representatives_votes_dossier"."id" = "representatives_votes_proposal"."dossier_id" ) LEFT OUTER JOIN "representatives_votes_document" ON ( "representatives_votes_dossier"."id" = "representatives_votes_document"."dossier_id" ) LEFT OUTER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) GROUP BY ... ORDER BY "nb_recommendations" DESC LIMIT #'
- db: SELECT ... FROM "representatives_votes_document" WHERE "representatives_votes_document"."dossier_id" IN (...)
- db: SELECT ... FROM "representatives_chamber" WHERE "representatives_chamber"."id" IN (...)
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (...)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
DossierProposalsTest.test_queries:
- db: 'SELECT ... FROM "representatives_votes_dossier" WHERE "representatives_votes_dossier"."id" = #'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (#)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
- db: 'SELECT ... FROM "representatives_votes_proposal" LEFT OUTER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) WHERE ("representatives_votes_proposal"."dossier_id" = # AND "representatives_recommendations_recommendation"."id" IS #) ORDER BY ...'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_proposals" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_proposals"."theme_id" ) WHERE "memopol_themes_theme_proposals"."proposal_id" IN (...)
DossierRecommendationsTest.test_queries:
- db: 'SELECT ... FROM "representatives_votes_dossier" WHERE "representatives_votes_dossier"."id" = #'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (#)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
- db: 'SELECT ... FROM "representatives_votes_proposal" INNER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) WHERE ("representatives_votes_proposal"."dossier_id" = # AND "representatives_recommendations_recommendation"."id" IS NOT NULL) ORDER BY ...'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_proposals" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_proposals"."theme_id" ) WHERE "memopol_themes_theme_proposals"."proposal_id" IN (...)
HomeTest.test_queries:
- db: 'SELECT COUNT(*) AS "__count" FROM "representatives_representative" INNER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE ("memopol_scores_representativescore"."score" < # OR "memopol_scores_representativescore"."score" > #)'
- db: 'SELECT ... FROM "representatives_representative" INNER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE ("memopol_scores_representativescore"."score" < # OR "memopol_scores_representativescore"."score" > #) ORDER BY ... LIMIT # OFFSET #'
- db: SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) LEFT OUTER JOIN "representatives_country" ON ( "representatives_constituency"."country_id" = "representatives_country"."id" ) WHERE "representatives_mandate"."representative_id" IN (#) ORDER BY ...
- db: 'SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" = #'
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
- db: 'SELECT ... FROM "representatives_votes_proposal" INNER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) INNER JOIN "representatives_votes_dossier" ON ( "representatives_votes_proposal"."dossier_id" = "representatives_votes_dossier"."id" ) WHERE "representatives_recommendations_recommendation"."id" IS NOT NULL ORDER BY "representatives_votes_proposal"."datetime" DESC LIMIT #'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_proposals" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_proposals"."theme_id" ) WHERE "memopol_themes_theme_proposals"."proposal_id" IN (...)
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (...)
- db: SELECT ... FROM "representatives_votes_document" WHERE "representatives_votes_document"."dossier_id" IN (...)
- db: SELECT ... FROM "representatives_chamber" WHERE "representatives_chamber"."id" IN (#)
- db: SELECT ... FROM "memopol_themes_theme" LEFT OUTER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) LEFT OUTER JOIN "memopol_themes_themelink" ON ( "memopol_themes_theme"."id" = "memopol_themes_themelink"."theme_id" ) LEFT OUTER JOIN "memopol_themes_theme_positions" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_positions"."theme_id" ) LEFT OUTER JOIN "memopol_themes_theme_proposals" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_proposals"."theme_id" ) WHERE "memopol_themes_theme"."featured" = true GROUP BY ...
- db: SELECT ... FROM "representatives_chamber" LEFT OUTER JOIN "representatives_votes_document" ON ( "representatives_chamber"."id" = "representatives_votes_document"."chamber_id" ) LEFT OUTER JOIN "representatives_votes_dossier" ON ( "representatives_votes_document"."dossier_id" = "representatives_votes_dossier"."id" ) LEFT OUTER JOIN "representatives_votes_proposal" ON ( "representatives_votes_dossier"."id" = "representatives_votes_proposal"."dossier_id" ) GROUP BY ...
RepresentativeDetailTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT "representatives_chamber"."abbreviation" FROM "representatives_chamber"
- db: 'SELECT ... FROM "representatives_representative" LEFT OUTER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE "representatives_representative"."slug" = #'
- db: SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) LEFT OUTER JOIN "representatives_country" ON ( "representatives_constituency"."country_id" = "representatives_country"."id" ) WHERE "representatives_mandate"."representative_id" IN (#) ORDER BY ...
- db: SELECT ... FROM "representatives_email" WHERE "representatives_email"."representative_id" IN (#)
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE (NOT ("representatives_website"."kind" IN (...)) AND NOT ("representatives_website"."kind" IN (...)) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_address" INNER JOIN "representatives_country" ON ( "representatives_address"."country_id" = "representatives_country"."id" ) WHERE "representatives_address"."representative_id" IN (#) ORDER BY "representatives_address"."id" ASC
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: 'SELECT ... FROM "representatives_phone" WHERE ("representatives_phone"."address_id" IS # AND "representatives_phone"."representative_id" IN (#))'
- db: SELECT ... FROM "memopol_scores_themescore" WHERE "memopol_scores_themescore"."representative_id" IN (#)
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (...)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "representatives_representative" WHERE "representatives_representative"."id" IN (#) ORDER BY ...
- cache|set: template.cache.position_form.#
RepresentativeListTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT COUNT(*) FROM (SELECT DISTINCT ... FROM "representatives_representative" WHERE "representatives_representative"."active" = true) subquery
- db: 'SELECT DISTINCT ... FROM "representatives_representative" LEFT OUTER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE "representatives_representative"."active" = true ORDER BY "representatives_representative"."last_name" ASC LIMIT #'
- db: SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) LEFT OUTER JOIN "representatives_country" ON ( "representatives_constituency"."country_id" = "representatives_country"."id" ) WHERE "representatives_mandate"."representative_id" IN (...) ORDER BY ...
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
RepresentativeMandatesTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT "representatives_chamber"."abbreviation" FROM "representatives_chamber"
- db: 'SELECT ... FROM "representatives_representative" LEFT OUTER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE "representatives_representative"."slug" = #'
- db: SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) LEFT OUTER JOIN "representatives_country" ON ( "representatives_constituency"."country_id" = "representatives_country"."id" ) WHERE "representatives_mandate"."representative_id" IN (#) ORDER BY ...
- db: SELECT ... FROM "representatives_email" WHERE "representatives_email"."representative_id" IN (#)
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE (NOT ("representatives_website"."kind" IN (...)) AND NOT ("representatives_website"."kind" IN (...)) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_address" INNER JOIN "representatives_country" ON ( "representatives_address"."country_id" = "representatives_country"."id" ) WHERE "representatives_address"."representative_id" IN (#) ORDER BY "representatives_address"."id" ASC
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: 'SELECT ... FROM "representatives_phone" WHERE ("representatives_phone"."address_id" IS # AND "representatives_phone"."representative_id" IN (#))'
- db: SELECT ... FROM "memopol_scores_themescore" WHERE "memopol_scores_themescore"."representative_id" IN (#)
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (...)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "representatives_representative" WHERE "representatives_representative"."id" IN (#) ORDER BY ...
- cache|set: template.cache.position_form.#
- db: 'SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) WHERE "representatives_mandate"."representative_id" = # ORDER BY ...'
RepresentativePositionsTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT "representatives_chamber"."abbreviation" FROM "representatives_chamber"
- db: 'SELECT ... FROM "representatives_representative" LEFT OUTER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE "representatives_representative"."slug" = #'
- db: SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) LEFT OUTER JOIN "representatives_country" ON ( "representatives_constituency"."country_id" = "representatives_country"."id" ) WHERE "representatives_mandate"."representative_id" IN (#) ORDER BY ...
- db: SELECT ... FROM "representatives_email" WHERE "representatives_email"."representative_id" IN (#)
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE (NOT ("representatives_website"."kind" IN (...)) AND NOT ("representatives_website"."kind" IN (...)) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_address" INNER JOIN "representatives_country" ON ( "representatives_address"."country_id" = "representatives_country"."id" ) WHERE "representatives_address"."representative_id" IN (#) ORDER BY "representatives_address"."id" ASC
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: 'SELECT ... FROM "representatives_phone" WHERE ("representatives_phone"."address_id" IS # AND "representatives_phone"."representative_id" IN (#))'
- db: SELECT ... FROM "memopol_scores_themescore" WHERE "memopol_scores_themescore"."representative_id" IN (#)
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (...)
- db: SELECT ... FROM "representatives_positions_position" INNER JOIN "representatives_positions_position_representatives" ON ( "representatives_positions_position"."id" = "representatives_positions_position_representatives"."position_id" ) WHERE ("representatives_positions_position"."published" = true AND "representatives_positions_position_representatives"."representative_id" IN (#)) ORDER BY ...
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_positions" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_positions"."theme_id" ) WHERE "memopol_themes_theme_positions"."position_id" IN (...)
- db: SELECT ... FROM "representatives_representative" INNER JOIN "representatives_positions_position_representatives" ON ( "representatives_representative"."id" = "representatives_positions_position_representatives"."representative_id" ) WHERE "representatives_positions_position_representatives"."position_id" IN (...) ORDER BY ...
- db: SELECT ... FROM "memopol_scores_positionscore" WHERE "memopol_scores_positionscore"."position_id" IN (...)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "representatives_representative" WHERE "representatives_representative"."id" IN (#) ORDER BY ...
- cache|set: template.cache.position_form.#
RepresentativeVotesTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT "representatives_chamber"."abbreviation" FROM "representatives_chamber"
- db: 'SELECT ... FROM "representatives_representative" LEFT OUTER JOIN "memopol_scores_representativescore" ON ( "representatives_representative"."id" = "memopol_scores_representativescore"."representative_id" ) WHERE "representatives_representative"."slug" = #'
- db: SELECT ... FROM "representatives_mandate" LEFT OUTER JOIN "representatives_group" ON ( "representatives_mandate"."group_id" = "representatives_group"."id" ) LEFT OUTER JOIN "representatives_chamber" ON ( "representatives_group"."chamber_id" = "representatives_chamber"."id" ) LEFT OUTER JOIN "representatives_constituency" ON ( "representatives_mandate"."constituency_id" = "representatives_constituency"."id" ) LEFT OUTER JOIN "representatives_country" ON ( "representatives_constituency"."country_id" = "representatives_country"."id" ) WHERE "representatives_mandate"."representative_id" IN (#) ORDER BY ...
- db: SELECT ... FROM "representatives_email" WHERE "representatives_email"."representative_id" IN (#)
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE ("representatives_website"."kind" IN (...) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_website" WHERE (NOT ("representatives_website"."kind" IN (...)) AND NOT ("representatives_website"."kind" IN (...)) AND "representatives_website"."representative_id" IN (#)) ORDER BY "representatives_website"."id" ASC
- db: SELECT ... FROM "representatives_address" INNER JOIN "representatives_country" ON ( "representatives_address"."country_id" = "representatives_country"."id" ) WHERE "representatives_address"."representative_id" IN (#) ORDER BY "representatives_address"."id" ASC
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: SELECT ... FROM "representatives_phone" WHERE "representatives_phone"."address_id" IN (...)
- db: 'SELECT ... FROM "representatives_phone" WHERE ("representatives_phone"."address_id" IS # AND "representatives_phone"."representative_id" IN (#))'
- db: SELECT ... FROM "memopol_scores_themescore" WHERE "memopol_scores_themescore"."representative_id" IN (#)
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (...)
- db: 'SELECT ... FROM "representatives_votes_vote" INNER JOIN "representatives_votes_proposal" ON ( "representatives_votes_vote"."proposal_id" = "representatives_votes_proposal"."id" ) INNER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) INNER JOIN "representatives_votes_dossier" ON ( "representatives_votes_proposal"."dossier_id" = "representatives_votes_dossier"."id" ) LEFT OUTER JOIN "memopol_scores_votescore" ON ( "representatives_votes_vote"."id" = "memopol_scores_votescore"."vote_id" ) WHERE (NOT ("representatives_recommendations_recommendation"."id" IS #) AND "representatives_votes_vote"."representative_id" IN (#)) ORDER BY ...'
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (...)
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (...)
- db: SELECT ... FROM "memopol_scores_dossierscore" WHERE "memopol_scores_dossierscore"."representative_id" IN (#)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "representatives_representative" WHERE "representatives_representative"."id" IN (#) ORDER BY ...
- cache|set: template.cache.position_form.#
ThemeDetailTest.test_queries:
- db: 'SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."slug" = #'
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (#)
- cache|set: template.cache.position_form.#
ThemeDossiersTest.test_queries:
- db: 'SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."slug" = #'
- db: SELECT ... FROM "representatives_votes_dossier" LEFT OUTER JOIN "representatives_votes_document" ON ( "representatives_votes_dossier"."id" = "representatives_votes_document"."dossier_id" ) LEFT OUTER JOIN "representatives_votes_proposal" ON ( "representatives_votes_dossier"."id" = "representatives_votes_proposal"."dossier_id" ) LEFT OUTER JOIN "representatives_recommendations_recommendation" ON ( "representatives_votes_proposal"."id" = "representatives_recommendations_recommendation"."proposal_id" ) INNER JOIN "memopol_themes_theme_dossiers" ON ( "representatives_votes_dossier"."id" = "memopol_themes_theme_dossiers"."dossier_id" ) WHERE "memopol_themes_theme_dossiers"."theme_id" IN (#) GROUP BY ("memopol_themes_theme_dossiers"."theme_id"), ... ORDER BY "representatives_votes_dossier"."id" DESC
- db: SELECT ... FROM "memopol_themes_theme" INNER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) WHERE "memopol_themes_theme_dossiers"."dossier_id" IN (...)
- db: SELECT ... FROM "representatives_votes_document" WHERE "representatives_votes_document"."dossier_id" IN (...)
- db: SELECT ... FROM "representatives_chamber" WHERE "representatives_chamber"."id" IN (...)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (#)
- cache|set: template.cache.position_form.#
ThemeLinksTest.test_queries:
- db: 'SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."slug" = #'
- db: SELECT ... FROM "memopol_themes_themelink" WHERE "memopol_themes_themelink"."theme_id" IN (#)
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- db: SELECT ... FROM "memopol_themes_theme" WHERE "memopol_themes_theme"."id" IN (#)
- cache|set: template.cache.position_form.#
ThemeListTest.test_queries:
- cache|get: django.contrib.sessions.cached_db#
- db: 'SELECT ... FROM "django_session" WHERE ("django_session"."expire_date" > #::timestamptz AND "django_session"."session_key" = #)'
- cache|set: django.contrib.sessions.cached_db#
- db: SELECT COUNT(*) FROM (SELECT ... FROM "memopol_themes_theme" LEFT OUTER JOIN "memopol_themes_theme_proposals" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_proposals"."theme_id" ) LEFT OUTER JOIN "memopol_themes_themelink" ON ( "memopol_themes_theme"."id" = "memopol_themes_themelink"."theme_id" ) LEFT OUTER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) LEFT OUTER JOIN "memopol_themes_theme_positions" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_positions"."theme_id" ) GROUP BY "memopol_themes_theme"."id") subquery
- db: 'SELECT ... FROM "memopol_themes_theme" LEFT OUTER JOIN "memopol_themes_theme_proposals" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_proposals"."theme_id" ) LEFT OUTER JOIN "memopol_themes_themelink" ON ( "memopol_themes_theme"."id" = "memopol_themes_themelink"."theme_id" ) LEFT OUTER JOIN "memopol_themes_theme_dossiers" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_dossiers"."theme_id" ) LEFT OUTER JOIN "memopol_themes_theme_positions" ON ( "memopol_themes_theme"."id" = "memopol_themes_theme_positions"."theme_id" ) GROUP BY ... ORDER BY "memopol_themes_theme"."name" ASC LIMIT #'
- db: SELECT ... FROM "memopol_settings_setting" WHERE "memopol_settings_setting"."key" IN (...)
- cache|get: template.cache.search_form.#
- cache|set: template.cache.search_form.#
- cache|get: template.cache.position_form.#
- cache|set: template.cache.position_form.#
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment