liquid_feedback_core

view lf_export @ 139:e3bfa2d7954c

Always ensure stable voting results by disqualifying certain initiatives, and bugfix related to setting "issue_state" in "calculate_ranks"

- Removed column "majority_indirect" from table "policy"
- Removed column "eligible" from table "initiative" ("eligible" can be calculated as "attainable"=TRUE AND "favored"=TRUE AND "disqualified"=FALSE)
- Split "rank" column of table "initiative" into columns "preliminary_rank" and "final_rank"
- Added column "disqualified" to table "initiative"
- Removed column "promising" from table "initiative"
- Removed constraints from table "initiative"
- Updated functions "close_voting" and "calculate_ranks"
- Added TODO notice in function "clean_issue"
author jbe
date Sun May 29 19:51:16 2011 +0200 (2011-05-29)
parents 2b03946cb0c2
children
line source
1 #!/bin/sh
3 if [ -z "$1" -o -z "$2" ]; then
4 echo "Usage: $0 <dbname> <filename>.sql.gz"
5 exit 1
6 fi
8 EXPORT_DBNAME=liquid_feedback_autoexport
9 retval=0
11 echo "Dropping database \"$EXPORT_DBNAME\" if existent..."
12 dropdb "$EXPORT_DBNAME" 2> /dev/null
13 echo "Copying database \"$1\" to new database \"$EXPORT_DBNAME\"..."
14 # TODO: use character encoding of original database
15 if (createdb "$EXPORT_DBNAME" && pg_dump "$1" | psql -f - "$EXPORT_DBNAME" > /dev/null)
16 then
17 echo "Deleting private data in copied database..."
18 if psql -v ON_ERROR_STOP=1 -c 'SELECT delete_private_data()' "$EXPORT_DBNAME" > /dev/null
19 then
20 echo "Dumping and compressing copied database to \"$2\"..."
21 if pg_dump --no-owner --no-privileges "$EXPORT_DBNAME" | gzip -9 > "$2"
22 then
23 true
24 else
25 retval=4
26 fi
27 else
28 retval=3
29 fi
30 else
31 retval=2
32 fi
33 echo "Dropping database \"$EXPORT_DBNAME\"..."
34 dropdb "$EXPORT_DBNAME"
35 echo "DONE."
36 exit $retval

Impressum / About Us