diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql index d114489..d9a0e45 100644 --- a/resources/sql/queries.auto.sql +++ b/resources/sql/queries.auto.sql @@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- File queries.sql -- --- autogenerated by adl.to-hugsql-queries at 2018-06-29T16:36:18.648Z +-- autogenerated by adl.to-hugsql-queries at 2018-06-29T22:21:53.869Z -- -- See [Application Description -- Language](https://github.com/simon-brooke/adl). @@ -392,7 +392,7 @@ ORDER BY visits.address_id, -- :name list-addresses :? :* -- :doc lists all existing address records -SELECT * FROM lv_addresses +SELECT DISTINCT * FROM lv_addresses ORDER BY lv_addresses.address, lv_addresses.postcode, lv_addresses.id @@ -411,13 +411,13 @@ ORDER BY lv_addresses.address, -- :name list-authorities :? :* -- :doc lists all existing authority records -SELECT * FROM lv_authorities +SELECT DISTINCT * FROM lv_authorities --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") -- :name list-canvassers :? :* -- :doc lists all existing canvasser records -SELECT * FROM lv_canvassers +SELECT DISTINCT * FROM lv_canvassers ORDER BY lv_canvassers.username, lv_canvassers.fullname, lv_canvassers.email, @@ -471,7 +471,7 @@ ORDER BY canvassers.username, -- :name list-districts :? :* -- :doc lists all existing district records -SELECT * FROM lv_districts +SELECT DISTINCT * FROM lv_districts ORDER BY lv_districts.name, lv_districts.id --~ (if (:offset params) "OFFSET :offset ") @@ -479,7 +479,7 @@ ORDER BY lv_districts.name, -- :name list-dwellings :? :* -- :doc lists all existing dwelling records -SELECT * FROM lv_dwellings +SELECT DISTINCT * FROM lv_dwellings ORDER BY lv_dwellings.address_id, lv_dwellings.sub_address, lv_dwellings.id @@ -498,7 +498,7 @@ ORDER BY lv_dwellings.address_id, -- :name list-electors :? :* -- :doc lists all existing elector records -SELECT * FROM lv_electors +SELECT DISTINCT * FROM lv_electors ORDER BY lv_electors.name, lv_electors.phone, lv_electors.email, @@ -533,7 +533,7 @@ ORDER BY lv_electors.name, -- :name list-followupactions :? :* -- :doc lists all existing followupaction records -SELECT * FROM lv_followupactions +SELECT DISTINCT * FROM lv_followupactions ORDER BY lv_followupactions.date, lv_followupactions.notes, lv_followupactions.id @@ -562,13 +562,13 @@ ORDER BY lv_followupactions.date, -- :name list-followupmethods :? :* -- :doc lists all existing followupmethod records -SELECT * FROM lv_followupmethods +SELECT DISTINCT * FROM lv_followupmethods --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") -- :name list-followuprequests :? :* -- :doc lists all existing followuprequest records -SELECT * FROM lv_followuprequests +SELECT DISTINCT * FROM lv_followuprequests ORDER BY lv_followuprequests.elector_id, lv_followuprequests.visit_id, lv_followuprequests.issue_id, @@ -622,13 +622,13 @@ ORDER BY lv_followuprequests.elector_id, -- :name list-genders :? :* -- :doc lists all existing gender records -SELECT * FROM lv_genders +SELECT DISTINCT * FROM lv_genders --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") -- :name list-intentions :? :* -- :doc lists all existing intention records -SELECT * FROM lv_intentions +SELECT DISTINCT * FROM lv_intentions --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -655,19 +655,19 @@ WHERE lv_intentions.Id = intentions.Id -- :name list-issues :? :* -- :doc lists all existing issue records -SELECT * FROM lv_issues +SELECT DISTINCT * FROM lv_issues --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") -- :name list-options :? :* -- :doc lists all existing option records -SELECT * FROM lv_options +SELECT DISTINCT * FROM lv_options --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") -- :name list-roles :? :* -- :doc lists all existing role records -SELECT * FROM lv_roles +SELECT DISTINCT * FROM lv_roles ORDER BY lv_roles.name, lv_roles.id --~ (if (:offset params) "OFFSET :offset ") @@ -684,7 +684,7 @@ ORDER BY roles.name, -- :name list-teams :? :* -- :doc lists all existing team records -SELECT * FROM lv_teams +SELECT DISTINCT * FROM lv_teams ORDER BY lv_teams.name, lv_teams.id --~ (if (:offset params) "OFFSET :offset ") @@ -710,7 +710,7 @@ ORDER BY lv_teams.name, -- :name list-visits :? :* -- :doc lists all existing visit records -SELECT * FROM lv_visits +SELECT DISTINCT * FROM lv_visits ORDER BY lv_visits.address_id, lv_visits.date, lv_visits.id @@ -739,7 +739,7 @@ ORDER BY lv_visits.address_id, -- :name search-strings-address :? :1 -- :doc selects existing address records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_addresses +SELECT DISTINCT * FROM lv_addresses WHERE false --~ (if (:address params) "OR address LIKE '%:address%'") --~ (if (:postcode params) "OR postcode LIKE '%:postcode%'") @@ -757,7 +757,7 @@ ORDER BY lv_addresses.address, -- :name search-strings-authority :? :1 -- :doc selects existing authority records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_authorities +SELECT DISTINCT * FROM lv_authorities WHERE false --~ (if (:request-token-uri params) "OR request_token_uri LIKE '%:request-token-uri%'") --~ (if (:access-token-uri params) "OR access_token_uri LIKE '%:access-token-uri%'") @@ -770,7 +770,7 @@ WHERE false -- :name search-strings-canvasser :? :1 -- :doc selects existing canvasser records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_canvassers +SELECT DISTINCT * FROM lv_canvassers WHERE false --~ (if (:username params) "OR username LIKE '%:username%'") --~ (if (:fullname params) "OR fullname LIKE '%:fullname%'") @@ -778,7 +778,7 @@ WHERE false --~ (if (:address_id params) "OR address_id = :address_id") --~ (if (:phone params) "OR phone LIKE '%:phone%'") --~ (if (:email params) "OR email LIKE '%:email%'") - --~ (if (:authority_id params) "OR authority_id = :authority_id") + --~ (if (:authority_id params) "OR authority_id LIKE '%:authority_id%'") --~ (if (:authorised params) "OR authorised = :authorised") --~ (if (:id params) "OR id = :id") ORDER BY lv_canvassers.username, @@ -790,7 +790,7 @@ ORDER BY lv_canvassers.username, -- :name search-strings-district :? :1 -- :doc selects existing district records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_districts +SELECT DISTINCT * FROM lv_districts WHERE false --~ (if (:name params) "OR name LIKE '%:name%'") --~ (if (:id params) "OR id = :id") @@ -801,7 +801,7 @@ ORDER BY lv_districts.name, -- :name search-strings-dwelling :? :1 -- :doc selects existing dwelling records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_dwellings +SELECT DISTINCT * FROM lv_dwellings WHERE false --~ (if (:address_id params) "OR address_id = :address_id") --~ (if (:sub-address params) "OR sub_address LIKE '%:sub-address%'") @@ -814,13 +814,13 @@ ORDER BY lv_dwellings.address_id, -- :name search-strings-elector :? :1 -- :doc selects existing elector records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_electors +SELECT DISTINCT * FROM lv_electors WHERE false --~ (if (:name params) "OR name LIKE '%:name%'") --~ (if (:dwelling_id params) "OR dwelling_id = :dwelling_id") --~ (if (:phone params) "OR phone LIKE '%:phone%'") --~ (if (:email params) "OR email LIKE '%:email%'") - --~ (if (:gender params) "OR gender = :gender") + --~ (if (:gender params) "OR gender LIKE '%:gender%'") --~ (if (:id params) "OR id = :id") ORDER BY lv_electors.name, lv_electors.phone, @@ -832,7 +832,7 @@ ORDER BY lv_electors.name, -- :name search-strings-followupaction :? :1 -- :doc selects existing followupaction records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_followupactions +SELECT DISTINCT * FROM lv_followupactions WHERE false --~ (if (:request_id params) "OR request_id = :request_id") --~ (if (:actor params) "OR actor = :actor") @@ -848,7 +848,7 @@ ORDER BY lv_followupactions.date, -- :name search-strings-followupmethod :? :1 -- :doc selects existing followupmethod records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_followupmethods +SELECT DISTINCT * FROM lv_followupmethods WHERE false --~ (if (:id params) "OR id LIKE '%:id%'") --~ (if (:offset params) "OFFSET :offset ") @@ -856,12 +856,12 @@ WHERE false -- :name search-strings-followuprequest :? :1 -- :doc selects existing followuprequest records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_followuprequests +SELECT DISTINCT * FROM lv_followuprequests WHERE false --~ (if (:elector_id params) "OR elector_id = :elector_id") --~ (if (:visit_id params) "OR visit_id = :visit_id") - --~ (if (:issue_id params) "OR issue_id = :issue_id") - --~ (if (:method_id params) "OR method_id = :method_id") + --~ (if (:issue_id params) "OR issue_id LIKE '%:issue_id%'") + --~ (if (:method_id params) "OR method_id LIKE '%:method_id%'") --~ (if (:id params) "OR id = :id") ORDER BY lv_followuprequests.elector_id, lv_followuprequests.visit_id, @@ -872,7 +872,7 @@ ORDER BY lv_followuprequests.elector_id, -- :name search-strings-gender :? :1 -- :doc selects existing gender records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_genders +SELECT DISTINCT * FROM lv_genders WHERE false --~ (if (:id params) "OR id LIKE '%:id%'") --~ (if (:offset params) "OFFSET :offset ") @@ -880,11 +880,11 @@ WHERE false -- :name search-strings-intention :? :1 -- :doc selects existing intention records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_intentions +SELECT DISTINCT * FROM lv_intentions WHERE false --~ (if (:visit_id params) "OR visit_id = :visit_id") --~ (if (:elector_id params) "OR elector_id = :elector_id") - --~ (if (:option_id params) "OR option_id = :option_id") + --~ (if (:option_id params) "OR option_id LIKE '%:option_id%'") --~ (if (:locality params) "OR locality = :locality") --~ (if (:Id params) "OR Id = :Id") --~ (if (:offset params) "OFFSET :offset ") @@ -892,7 +892,7 @@ WHERE false -- :name search-strings-issue :? :1 -- :doc selects existing issue records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_issues +SELECT DISTINCT * FROM lv_issues WHERE false --~ (if (:url params) "OR url LIKE '%:url%'") --~ (if (:current params) "OR current = :current") @@ -902,7 +902,7 @@ WHERE false -- :name search-strings-option :? :1 -- :doc selects existing option records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_options +SELECT DISTINCT * FROM lv_options WHERE false --~ (if (:id params) "OR id LIKE '%:id%'") --~ (if (:offset params) "OFFSET :offset ") @@ -910,7 +910,7 @@ WHERE false -- :name search-strings-role :? :1 -- :doc selects existing role records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_roles +SELECT DISTINCT * FROM lv_roles WHERE false --~ (if (:name params) "OR name LIKE '%:name%'") --~ (if (:id params) "OR id = :id") @@ -921,7 +921,7 @@ ORDER BY lv_roles.name, -- :name search-strings-team :? :1 -- :doc selects existing team records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_teams +SELECT DISTINCT * FROM lv_teams WHERE false --~ (if (:name params) "OR name LIKE '%:name%'") --~ (if (:district_id params) "OR district_id = :district_id") @@ -935,7 +935,7 @@ ORDER BY lv_teams.name, -- :name search-strings-visit :? :1 -- :doc selects existing visit records having any string field matching the parameter of the same name by substring match -SELECT * FROM lv_visits +SELECT DISTINCT * FROM lv_visits WHERE false --~ (if (:address_id params) "OR address_id = :address_id") --~ (if (:canvasser_id params) "OR canvasser_id = :canvasser_id") diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html index 7305958..db28ab2 100644 --- a/resources/templates/auto/application-index.html +++ b/resources/templates/auto/application-index.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -23,23 +23,43 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> {% block content %}
- -Elector + +Address

-All electors known to the system; electors are people believed to be entitled to vote in the current campaign. +Addresses of all buildings which contain dwellings.

- -Gender + +Authority

-All genders which may be assigned to electors. +Authorities which may authenticate canvassers to the system. +

+
+
+ +Canvasser + +
+
+

+Primary users of the system: those actually interviewing electors. +

+
+
+ +District + +
+
+

+Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps.

@@ -58,43 +78,50 @@ All dwellings within addresses in the system; a dwelling is a

- -Address + +Elector

-Addresses of all buildings which contain dwellings. +All electors known to the system; electors are people believed to be entitled to vote in the current campaign.

- -Visit + +Followupaction

-All visits made by canvassers to dwellings in which opinions were recorded. +Actions taken on followup requests.

- -Authority + +Followupmethod + +
+
+
+
+ +Followuprequest

-Authorities which may authenticate canvassers to the system. +Requests for a followup with an issue expert

- -Issue + +Gender

-Issues believed to be of interest to electors, about which they may have questions. +All genders which may be assigned to electors.

@@ -108,23 +135,23 @@ Intentions of electors to vote for options elicited in visits.

- -Canvasser + +Issue

-Primary users of the system: those actually interviewing electors. +Issues believed to be of interest to electors, about which they may have questions.

- -Followuprequest + +Option

-Requests for a followup with an issue expert +Options in the election or referendum being canvassed on

@@ -145,42 +172,15 @@ Team
- -District + +Visit

-Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps. +All visits made by canvassers to dwellings in which opinions were recorded.

-
- -Followupaction - -
-
-

-Actions taken on followup requests. -

-
-
- -Option - -
-
-

-Options in the election or referendum being canvassed on -

-
-
- -Followupmethod - -
-
-
{% endblock %} diff --git a/resources/templates/base.html b/resources/templates/base.html index 5012065..e9add78 100644 --- a/resources/templates/base.html +++ b/resources/templates/base.html @@ -34,6 +34,9 @@ {% endblock %}
+
-
{% block foot %}