liquid_feedback_frontend
view db/demodata.lua @ 6:8d91bccab0bf
Version beta2
Possibility to browse voters of a closed issue
Registration with invite code
Email confirmation and password recovery
Download function (for database dumps) added
Critical bug solved, which made it impossible to select your opinion on other peoples suggestions
Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted
Fixed wrong sorting order for "supporters" or "potential supporters"
Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)
Strip space characters from certain fields and ensure they contain at least 3 characters
Showing grade in opinion/list as clear text instead of integer value
More information on initiative is displayed while voting
Colored notification box shown on pages of issues or initiatives which are currently in voting state
Changed default filter for issues to "Open"
Back link on suggestion page
Some optical changes
Removed wrong space character in LICENSE file
Possibility to browse voters of a closed issue
Registration with invite code
Email confirmation and password recovery
Download function (for database dumps) added
Critical bug solved, which made it impossible to select your opinion on other peoples suggestions
Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted
Fixed wrong sorting order for "supporters" or "potential supporters"
Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)
Strip space characters from certain fields and ensure they contain at least 3 characters
Showing grade in opinion/list as clear text instead of integer value
More information on initiative is displayed while voting
Colored notification box shown on pages of issues or initiatives which are currently in voting state
Changed default filter for issues to "Open"
Back link on suggestion page
Some optical changes
Removed wrong space character in LICENSE file
author | bsw/jbe |
---|---|
date | Sat Jan 02 12:00:00 2010 +0100 (2010-01-02) |
parents | 3bfb2fcf7ab9 |
children |
line source
1 #!/usr/bin/env lua
3 member_count = 10000
4 area_count = 24
5 issue_count = 1000
6 policy_count = 3 -- do not change
8 function write(...)
9 io.stdout:write(...)
10 end
11 function writeln(...)
12 write(...)
13 write("\n")
14 end
16 math.randomseed(os.time())
18 writeln('BEGIN;')
20 for i = 2, member_count do
21 writeln('INSERT INTO "member" ("login", "name", "ident_number") VALUES (', "'testuser", i, "', 'Benutzer #", i, "', 'TEST", i, "');")
22 end
24 for i = 1, member_count do
25 local is_linked = {}
26 while math.random(4) > 1 do
27 local k = math.random(member_count)
28 if not is_linked[k] then
29 local public = math.random(2) == 1 and "TRUE" or "FALSE"
30 writeln('INSERT INTO "contact" ("member_id", "other_member_id", "public") VALUES (', i, ", ", k, ", ", public, ");")
31 is_linked[k] = true
32 end
33 end
34 end
36 for i = 2, area_count do
37 writeln('INSERT INTO "area" ("name") VALUES (', "'Area #", i, "');")
38 end
40 local memberships = {}
42 for i = 1, area_count do
43 memberships[i] = {}
44 for j = 1, member_count do
45 if math.random(4) == 1 then
46 memberships[i][j] = true
47 local autoreject = math.random(2) == 1 and "TRUE" or "FALSE"
48 writeln('INSERT INTO "membership" ("member_id", "area_id", "autoreject") VALUES (', j, ", ", i, ", ", autoreject, ");")
49 end
50 end
51 end
53 do
54 local issue_initiative_count = {}
55 local initiative_draft_count = {}
56 local initiative_idx = 1
57 local draft_count = 0
58 for i = 1, issue_count do
59 local area = math.random(area_count)
60 writeln('INSERT INTO "issue" ("area_id", "policy_id") VALUES (', area, ", ", math.random(policy_count), ");")
61 issue_initiative_count[i] = 1
62 while math.random(3) > 1 do
63 issue_initiative_count[i] = issue_initiative_count[i] + 1
64 end
65 for j = 1, issue_initiative_count[i] do
66 writeln('INSERT INTO "initiative" ("issue_id", "name") VALUES (', i, ", 'Initiative #", initiative_idx, "');")
67 initiative_draft_count[i] = 1
68 while math.random(4) > 1 do
69 initiative_draft_count[i] = initiative_draft_count[i] + 1
70 end
71 local initiators = {}
72 local is_used = {}
73 repeat
74 local member = math.random(member_count)
75 if not is_used[member] then
76 initiators[#initiators+1] = member
77 is_used[member] = true
78 end
79 until math.random(2) == 1
80 for k = 1, initiative_draft_count[i] do
81 draft_count = draft_count + 1
82 writeln('INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES (', initiative_idx, ", ", initiators[math.random(#initiators)], ", 'Lorem ipsum... (#", draft_count, ")');")
83 end
84 for k = 1, #initiators do
85 local member = math.random(member_count)
86 writeln('INSERT INTO "initiator" ("member_id", "initiative_id") VALUES (', initiators[k], ", ", initiative_idx, ");")
87 if math.random(50) > 1 then
88 writeln('INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES (', initiators[k], ", ", initiative_idx, ", ", draft_count - math.random(initiative_draft_count[i]) + 1, ");")
89 end
90 end
91 local probability = math.random(99) + 1
92 for k = 1, member_count do
93 if not is_used[k] and (memberships[area][k] and math.random(probability) <= 4 or math.random(probability) == 1) then
94 writeln('INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES (', k, ", ", initiative_idx, ", ", draft_count - math.random(initiative_draft_count[i]) + 1, ");")
95 end
96 end
97 initiative_idx = initiative_idx + 1
98 end
99 end
100 end
102 writeln('END;')