README | 64 ++++++++++++++++++++++++ README.txt | 64 ------------------------ UPDATE-NOTES | 5 - elections.sql | 125 ++++++++++++++++++++++++++--------------------- elections/controllers.py | 2 elections/model.py | 18 +++--- elections/release.py | 6 +- 7 files changed, 146 insertions(+), 138 deletions(-)
New commits: commit e2ea80f8020912efca1a807a5346986595098e4b Author: Nigel Jones dev@nigelj.com Date: Mon Oct 6 20:12:02 2008 +1300
Clean UPDATE-NOTES
diff --git a/UPDATE-NOTES b/UPDATE-NOTES index 370fbba..8b13789 100644 --- a/UPDATE-NOTES +++ b/UPDATE-NOTES @@ -1,6 +1 @@ -Schema Changes for 0.1.5:
-* Default value for votes.timestamp should be removed -* Column 'candidates.formalname' type text w/ null values to be added -* View fvotecount to be added -* Column 'candidates.url' to allow 'null' entries
commit c4b1d32be61b974001fba644db4889b05bdce91a Author: Nigel Jones dev@nigelj.com Date: Mon Oct 6 17:31:10 2008 +1300
I hate .txt....
diff --git a/README b/README new file mode 100644 index 0000000..6ecb5c5 --- /dev/null +++ b/README @@ -0,0 +1,64 @@ +Documentation + +* What is fedora-election? +fedora-elections is a web application written in python and based on +TurboGears which aim to help to make decisions where is necessary to +give a preferences. +This project is developed over fedoraproject requests, but, +can be easily adapt to be used from any other association/project. +Fedora-elections is integrated with Fedora Account System (FAS) and +provides an agile and easy interface to make decision using votes. + + +* Installation +You can get files by svn repository. You need a valid FAS account in +particular you need to upload your ssh public key because svn require +authentication also to checkout/update. + +Before launch fedora-elections, you need this packages installed on your +machine: + - postgresql-server + - TurboGears + - CherryPy + - python-fedora (you need to enable fedora testing-updates repository) + +Before start fedora elections you need to set-up property your database. + +Copy your dev-dist.cfg to dev.cfg and start to edit it. This is your +development configuration file. prod.cfg is your Production configuration +file. + + - sqlite +SQLite is useful to quick start because doesn't need any type of +configuration. +You have just to edit dev.cfg and make sure you have a line like this: + + sqlalchemy.dburi="sqlite://path_of_your_database" + + - PostgreSQL +First of all you need to create and configure an user and database +and give permission on it. + +su - postgres +createuse felections +createdb -O felections felections +psql felections felection < /path/to/election/trunk/elections.sql + +(don't forget to edit your pg_sql.conf data and assign to felections on +your host) + +* How to start +Fedora-elections can be started by running the +start-elections.py script. + + +* How to contribute +If you find bug or want to propose ideas or stuff to be implemented or if +you are interested to became a developer for this project just +ask on #fedora-admin irc channel on irc.freenode.net or use our +web site https://fedorahosted.org/elections. + +* Licence +fedora-elections is licenced under GPL v2. + + diff --git a/README.txt b/README.txt deleted file mode 100644 index 6ecb5c5..0000000 --- a/README.txt +++ /dev/null @@ -1,64 +0,0 @@ -Documentation - -* What is fedora-election? -fedora-elections is a web application written in python and based on -TurboGears which aim to help to make decisions where is necessary to -give a preferences. -This project is developed over fedoraproject requests, but, -can be easily adapt to be used from any other association/project. -Fedora-elections is integrated with Fedora Account System (FAS) and -provides an agile and easy interface to make decision using votes. - - -* Installation -You can get files by svn repository. You need a valid FAS account in -particular you need to upload your ssh public key because svn require -authentication also to checkout/update. - -Before launch fedora-elections, you need this packages installed on your -machine: - - postgresql-server - - TurboGears - - CherryPy - - python-fedora (you need to enable fedora testing-updates repository) - -Before start fedora elections you need to set-up property your database. - -Copy your dev-dist.cfg to dev.cfg and start to edit it. This is your -development configuration file. prod.cfg is your Production configuration -file. - - - sqlite -SQLite is useful to quick start because doesn't need any type of -configuration. -You have just to edit dev.cfg and make sure you have a line like this: - - sqlalchemy.dburi="sqlite://path_of_your_database" - - - PostgreSQL -First of all you need to create and configure an user and database -and give permission on it. - -su - postgres -createuse felections -createdb -O felections felections -psql felections felection < /path/to/election/trunk/elections.sql - -(don't forget to edit your pg_sql.conf data and assign to felections on -your host) - -* How to start -Fedora-elections can be started by running the -start-elections.py script. - - -* How to contribute -If you find bug or want to propose ideas or stuff to be implemented or if -you are interested to became a developer for this project just -ask on #fedora-admin irc channel on irc.freenode.net or use our -web site https://fedorahosted.org/elections. - -* Licence -fedora-elections is licenced under GPL v2. - -
commit af93252c3fa00f6dd775ef24acbaa214dde3de65 Author: Nigel Jones dev@nigelj.com Date: Mon Oct 6 17:27:33 2008 +1300
Update SQL schema
diff --git a/elections.sql b/elections.sql index 13bb90a..9674637 100644 --- a/elections.sql +++ b/elections.sql @@ -1,62 +1,77 @@ -drop table votes; -drop table candidates; -drop table legalVoters; -drop table elections; - -create table elections ( -id serial, -shortname text not null, -name text not null, -info text not null, -url text not null, -start_date timestamp not null, -end_date timestamp not null, -max_seats integer not null, --- NEW COL - Hold elections that allow multiple votes per user -votes_per_user integer not null, --- NEW COL - Show results during a running election -public_results integer not null, -embargoed integer not null, -unique(shortname), -primary key (id) -); - -create table legalVoters ( -id serial, -election_id integer not null, -group_name text not null, -foreign key (election_id) references elections (id), -primary key (id) -); - -create table candidates ( -id serial, -election_id integer not null, -name text not null, -formalname text, +drop table if exists votes; +drop table if exists candidates; +drop table if exists legalvoters; +drop table if exists elections; +drop view if exists votecount; +drop view if exists fvotecount; +drop view if exists uservotes; + +CREATE TABLE elections ( +id integer NOT NULL auto_increment, +-- Old 'shortname' +alias varchar(50) NOT NULL, +-- Numerical value, specifying what stage the election is in +status tinyint NOT NULL, +-- Numerical value, specifying what voting method is used +method tinyint NOT NULL, +shortdesc text NOT NULL, +description text NOT NULL, +url text NOT NULL, +start_date timestamp NOT NULL, +end_date timestamp NOT NULL, +-- Show results during a running election +public_results boolean NOT NULL, +-- Does this election support nominations? +allow_nominations boolean NOT NULL, +-- If so, when do they have to be in by? +nomination_end timestamp NOT NULL, + +UNIQUE (alias), +PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE legalvoters ( +id integer NOT NULL auto_increment, +election_id integer NOT NULL, +type integer NOT NULL, +group_name text NOT NULL, +FOREIGN KEY (election_id) references elections (id), +INDEX (election_id, type), +PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE candidates ( +id integer NOT NULL auto_increment, +election_id integer NOT NULL, +-- Numerical value, specifying candidates' "status" +status tinyint NOT NULL, +human boolean NOT NULL, +name text NOT NULL, url text, -foreign key (election_id) references elections (id), -unique(id), -primary key (id, election_id) -); - -create table votes ( -id serial, --- voter_id will refer to someones fas ID -voter text not null, -"timestamp" timestamp without time zone NOT NULL, -candidate_id integer not null, -weight integer not null, -election_id integer not null, +blurb text, +nominated_by text, +FOREIGN KEY (election_id) references elections (id), +PRIMARY KEY (id, election_id) +) ENGINE=InnoDB; + +CREATE TABLE votes ( +id integer NOT NULL auto_increment, +voter text NOT NULL, +candidate_id integer NOT NULL, +weight integer NOT NULL, +election_id integer NOT NULL, -- unique(voter_id, candidate_id, election_id), -foreign key (candidate_id) references candidates(id), -foreign key (election_id) references elections(id), -primary key (id) -); +FOREIGN KEY (candidate_id) references candidates (id), +FOREIGN KEY (election_id) references elections (id), +PRIMARY KEY (id) +) ENGINE=InnoDB; + +#CREATE TABLE questions ( +# +#) ENGINE=InnoDB;
create view votecount as select candidate_id, election_id, sum(weight) as novotes from votes group by candidate_id, election_id order by novotes desc;
create view fvotecount as select c.id, c.name, v.election_id, v.novotes from votecount v, candidates c where c.id = v.candidate_id order by novotes desc;
-create view uservotes as select election_id, voter, count(voter) as novotes from -votes group by election_id, voter; +create view uservotes as select election_id, voter, count(voter) as novotes from votes group by election_id, voter; diff --git a/elections/model.py b/elections/model.py index 29526e7..77c27ab 100644 --- a/elections/model.py +++ b/elections/model.py @@ -67,17 +67,15 @@ class UserVoteCount(SABase): # set up mappers between tables and classes #
-mapper(Elections, ElectionsTable) -mapper(Votes, VotesTable, properties = { - 'candidate': relation(Candidates, backref='votes') +mapper(Elections, ElectionsTable, properties = { + 'legalVoters': relation(LegalVoters, backref='election'), + 'candidates': relation(Candidates, backref='election') }) +mapper(Votes, VotesTable) mapper(Candidates, CandidatesTable, properties = { - 'election': relation(Elections, backref='candidates') - }) -mapper(LegalVoters, LegalVotersTable, properties = { - 'election': relation(Elections, backref='legalVoters') - }) -mapper(VoteTally, VoteTallyTable, properties = { - 'candidate': relation(Candidates, backref='tally') + 'votes': relation(Votes, backref='candidate'), + 'tally': relation(VoteTally, backref='candidate') }) +mapper(LegalVoters, LegalVotersTable) +mapper(VoteTally, VoteTallyTable) mapper(UserVoteCount, UserVoteCountTable)
commit bc090b6cafc04c71a7d8f9791743ca2acec78a51 Author: Nigel Jones dev@nigelj.com Date: Sun Sep 28 15:32:45 2008 +1300
Make some small adjustments
diff --git a/elections/release.py b/elections/release.py index dc67c2e..9e68a7f 100644 --- a/elections/release.py +++ b/elections/release.py @@ -24,15 +24,15 @@
# Release information about elections
-version = "0.1.5" +version = "0.1.9"
description = "Elections Application for Fedora Project" # long_description = "More description about your plan" author = "Nigel Jones, Toshio Kuratomi, Ricky Zhou, Luca Foppiano" -email = "svnelections-members@fedoraproject.org" +email = "gitelections-members@fedoraproject.org" copyright = "Nigel Jones, Toshio Kuratomi, Ricky Zhou, Luca Foppiano - 2008"
# if it's open source, you might want to specify these -url = "http://www.fedorahosted.org/elections" +url = "http://fedorahosted.org/elections" # download_url = "http://yourcool.site/download" license = "GPLv2"
commit d11221a0069bd03f4be5435d25c9376c7359a9a7 Author: Nigel Jones dev@nigelj.com Date: Sun Sep 28 15:31:10 2008 +1300
Change where fas2 is loaded from (API change)
diff --git a/elections/controllers.py b/elections/controllers.py index 30deed7..d6f7008 100644 --- a/elections/controllers.py +++ b/elections/controllers.py @@ -28,7 +28,7 @@ from turbogears import identity from turbogears.database import session from cherrypy import request, response
-from fedora.accounts.fas2 import AccountSystem +from fedora.client.fas2 import AccountSystem from elections import model from elections.model import * from elections.admin import Admin
elections-devel@lists.stg.fedorahosted.org