Merge lp:~graeme-acm/sahana-eden/LA into lp:sahana-eden/la
- LA
- Merge into la
Status: | Superseded |
---|---|
Proposed branch: | lp:~graeme-acm/sahana-eden/LA |
Merge into: | lp:sahana-eden/la |
Diff against target: |
291 lines (+110/-44) 6 files modified
.bzrignore (+1/-0) controllers/vol.py (+0/-6) models/vol.py (+62/-0) modules/s3/s3tools.py (+42/-34) private/prepopulate/demo/LA/tasks.txt (+3/-2) tests/selenium/selenium-version (+2/-2) |
To merge this branch: | bzr merge lp:~graeme-acm/sahana-eden/LA |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Fran Boon | Needs Fixing | ||
Review via email: mp+71067@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-08-10.
Commit message
Description of the change
I've added a function that will update the req_req totals. Based on application_
create the assignment (although it could quite easily do that if you would prefer)
send the email
It would be possible with a little modification to call this from application_
Whilst working through the Selenium Tests with Michael we needed to upgrade the Selenium server (the previous one had a b in the version so not certain if it was a beta anyway) But it didn't have support for FF5. Now I realise this is a big file and should be removed from trunk but until I have a script that will prompt for a download it if it is not on the system I'd rather keep it in trunk to make it easier for people to start running the tests. I hope that is all right, if not then let me know and I'll add it to the bzr ignore list.
- 2373. By graeme-acm
-
volunteer roster report, and vol application prepop
- 2374. By graeme-acm
-
merge la
- 2375. By graeme-acm
-
merge la
- 2376. By graeme-acm
-
prepopulate fix and some bug fixes
- 2377. By graeme-acm
-
vol assignment form
- 2378. By graeme-acm
-
merge la, fix importer bug
- 2379. By graeme-acm
-
vol assignment form
- 2380. By graeme-acm
-
merge la
- 2381. By graeme-acm
-
vol assignment form
- 2382. By graeme-acm
-
merge la
- 2383. By graeme-acm
-
volunteer assignment form
- 2384. By graeme-acm
-
merge la
- 2385. By graeme-acm
-
merge trunk
- 2386. By graeme-acm
-
fixes to prepopulate and some pdf reports
- 2387. By graeme-acm
-
make prepopulate flag a simple numerical flag
- 2388. By graeme-acm
-
merge trunk
- 2389. By graeme-acm
-
fix for dateutils and re_req import
- 2390. By graeme-acm
-
merge trunk
- 2391. By graeme-acm
-
fix for pre-populate flag in 000_config
- 2392. By graeme-acm
-
merge trunk
- 2393. By graeme-acm
-
minor bug fix
- 2394. By graeme-acm
-
merge trunk
- 2395. By graeme-acm
-
merge trunk
- 2396. By graeme-acm
-
changes to vol assignment pdf - see logs
- 2397. By graeme-acm
-
add volunteer certificate
- 2398. By graeme-acm
-
fixed bug in volunteer roster
- 2399. By graeme-acm
-
fixed bug set margin and then used margins in volunteer assignment report
- 2400. By graeme-acm
-
redo the certificate
- 2401. By graeme-acm
-
merge trunk
- 2402. By graeme-acm
-
merge trunk
- 2403. By graeme-acm
-
vol & don certificates
- 2404. By graeme-acm
-
merge trunk
- 2405. By graeme-acm
-
donation certificate
- 2406. By graeme-acm
-
merge trunk
- 2407. By graeme-acm
-
logo in volunteer badge
- 2408. By graeme-acm
-
date represent change and vol assignmnet pdf tweak
- 2409. By graeme-acm
-
fix date represent for utc
- 2410. By graeme-acm
-
various fixes logs 152, 227 & 276
- 2411. By graeme-acm
-
various logs.
- 2412. By graeme-acm
-
merge trunk
- 2413. By graeme-acm
-
fix personal menu to give it maximum space available
- 2414. By graeme-acm
-
bug fix when adding donation form button (if no rheader bang)
- 2415. By graeme-acm
-
some work on the donation form plus fix to log 298
- 2416. By graeme-acm
-
merge trunk
- 2417. By graeme-acm
-
donation request from
- 2418. By graeme-acm
-
restrict an org to commit vols to the slots available
- 2419. By graeme-acm
-
log 306 - Excel colours
- 2420. By graeme-acm
-
change prepopulate to use new importer code (actual change rolled back until it works with the demos that we have)
- 2421. By graeme-acm
-
added a link for printing of a volunteer certificate
- 2422. By graeme-acm
-
breadcrumbs and warnings were overlapping
- 2423. By graeme-acm
-
merge trunk - resolve conflict
- 2424. By graeme-acm
-
fix emergency contacts on pre-populate
- 2425. By graeme-acm
-
merge trunk
- 2426. By graeme-acm
-
Update Help add FAQ
- 2427. By graeme-acm
-
merge trunk
- 2428. By graeme-acm
-
fix string %(descriptors)s
- 2429. By graeme-acm
-
merge trunk
- 2430. By graeme-acm
-
merge trunk
- 2431. By graeme-acm
-
donation certificate
- 2432. By graeme-acm
-
donation req signature
- 2433. By graeme-acm
-
donation add cert and request button and add signature line for certificate
- 2434. By graeme-acm
-
removed comment, confirmation received
- 2435. By graeme-acm
-
added on validate to the create org popup
- 2436. By graeme-acm
-
merge trunk
- 2437. By graeme-acm
-
merge trunk
- 2438. By graeme-acm
-
merge trunk
- 2439. By graeme-acm
-
merge trunk
- 2440. By graeme-acm
-
fix for log 347 vol ass form check in and check out time
- 2441. By graeme-acm
-
added selenium scripts used to generate the language file
- 2442. By graeme-acm
-
merge trunk
- 2443. By graeme-acm
-
minor tweaks to PDF and xls output
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2011-06-15 15:46:34 +0000 |
3 | +++ .bzrignore 2011-08-10 16:21:59 +0000 |
4 | @@ -36,6 +36,7 @@ |
5 | tests/prepopulate/user/* |
6 | tests/selenium/results/* |
7 | tests/selenium/scripts/diagTestResults.txt |
8 | +tests/selenium/server/selenium-server.jar |
9 | tests/selenium/results/* |
10 | tests/selenium/tests/* |
11 | tests/unit/*.pdf |
12 | |
13 | === modified file 'controllers/vol.py' |
14 | --- controllers/vol.py 2011-08-09 14:44:27 +0000 |
15 | +++ controllers/vol.py 2011-08-10 16:21:59 +0000 |
16 | @@ -1234,9 +1234,3 @@ |
17 | return s3_rest_controller("project", "task") |
18 | |
19 | # END ========================================================================= |
20 | -def application(): |
21 | - """ REST Controller """ |
22 | - |
23 | - s3mgr.load("vol_application") |
24 | - output = s3_rest_controller(module, resourcename) |
25 | - return output |
26 | \ No newline at end of file |
27 | |
28 | === modified file 'models/vol.py' |
29 | --- models/vol.py 2011-08-09 16:54:13 +0000 |
30 | +++ models/vol.py 2011-08-10 16:21:59 +0000 |
31 | @@ -216,6 +216,67 @@ |
32 | |
33 | return |
34 | |
35 | + def application_onaccept(req_num): |
36 | + """ |
37 | + Check whether full |
38 | + if full: |
39 | + return false |
40 | + else: |
41 | + Add a vol_assignment record |
42 | + Update the req's commit qty |
43 | + If req now full then return "Full" |
44 | + Else return True |
45 | + """ |
46 | + rrtable = db.req_req |
47 | + rstable = db.req_req_skill |
48 | + query = (rrtable.request_number == req_num) & \ |
49 | + (rrtable.id == rstable.req_id) |
50 | + record = db(query).select(rrtable.id, |
51 | + rstable.quantity, |
52 | + rstable.quantity_commit, |
53 | + limitby=(0, 1)).first() |
54 | + if record and \ |
55 | + record.req_req_skill.quantity > record.req_req_skill.quantity_commit: |
56 | + # Lookup the Report To |
57 | + req_id = record.req_req.id |
58 | + _req = db(rrtable.id == req_id).select(rrtable.request_for_id, |
59 | + limitby=(0, 1)).first() |
60 | + if _req: |
61 | + report_to = _req.request_for_id |
62 | + else: |
63 | + report_to = None |
64 | + # Add Assignment |
65 | + vatable = db.vol_assignment |
66 | + query = (vatable.req_id == req_id) & \ |
67 | + (vatable.deleted == False) |
68 | + rows = db(query).select(vatable.number) |
69 | + qty = 0 |
70 | + for row in rows: |
71 | + qty = qty + row.number |
72 | + if qty >= record.req_req_skill.quantity: |
73 | + commit_status = 2 # Complete (defined in models/req.py) |
74 | + else: |
75 | + commit_status = 1 # Partial |
76 | + db(rstable.req_id == req_id).update(quantity_commit = qty) |
77 | + db(rrtable.id == req_id).update(commit_status = commit_status) |
78 | + if commit_status == 2: |
79 | + return "Full" |
80 | + else: |
81 | + return True |
82 | + else: |
83 | + return False |
84 | + return |
85 | + |
86 | + def vol_application_onaccept_csv(req_csv): |
87 | + from csv import DictReader |
88 | + csvReader = DictReader(open(req_csv, 'rb')) |
89 | + for r in csvReader: |
90 | + # this relies on the named field being in the import file |
91 | + reqNum = r["Request Number"] |
92 | + application_onaccept(reqNum) |
93 | + |
94 | + |
95 | + |
96 | s3mgr.configure(tablename, |
97 | onvalidation = application_onvalidation, |
98 | #create_onaccept = application_onaccept, |
99 | @@ -765,6 +826,7 @@ |
100 | # Pass variables back to global scope (response.s3.*) |
101 | return dict( |
102 | application_onaccept_interactive = application_onaccept_interactive, |
103 | + vol_application_onaccept_csv = vol_application_onaccept_csv, |
104 | vol_rostermail = vol_rostermail, |
105 | ) |
106 | |
107 | |
108 | === modified file 'modules/s3/s3tools.py' |
109 | --- modules/s3/s3tools.py 2011-08-08 15:59:19 +0000 |
110 | +++ modules/s3/s3tools.py 2011-08-10 16:21:59 +0000 |
111 | @@ -674,6 +674,7 @@ |
112 | self.s3base = s3base |
113 | self.importTasks = [] |
114 | self.specialTasks = [] |
115 | + self.tasks = [] |
116 | self.alternateTables = {"hrm_person": {"tablename":"hrm_human_resource", |
117 | "loader":response.s3.hrm_person_loader, |
118 | "prefix":"pr", |
119 | @@ -682,6 +683,7 @@ |
120 | "req_req_item":{"loader":response.s3.req_item_loader}, |
121 | } |
122 | self.errorList = [] |
123 | + self.resultList = [] |
124 | |
125 | def load_descriptor(self, path): |
126 | """ Method that will load the descriptor file and then all the |
127 | @@ -739,6 +741,7 @@ |
128 | self.errorList.append( |
129 | "Failed to find a transform file, Giving up.") |
130 | return |
131 | + self.tasks.append([1,app, res, csv, xsl]) |
132 | self.importTasks.append([app, res, csv, xsl]) |
133 | else: |
134 | self.errorList.append( |
135 | @@ -753,6 +756,7 @@ |
136 | extraArgs = None |
137 | if len(details) == 4: |
138 | extraArgs = details[3].strip('" ') |
139 | + self.tasks.append([2,function,csv,extraArgs]) |
140 | self.specialTasks.append([function,csv,extraArgs]) |
141 | |
142 | def load_import(self, controller, csv, xsl): |
143 | @@ -761,23 +765,24 @@ |
144 | """ |
145 | self.importTasks.append([controller, csv, xsl]) |
146 | |
147 | - def execute_import_tasks(self): |
148 | + def execute_import_task(self, task): |
149 | """ Method that will execute each import job, in order """ |
150 | |
151 | - manager = self.manager |
152 | - db = current.db |
153 | - request = current.request |
154 | - response = current.response |
155 | - errorString = "prepopulate error: file %s missing" |
156 | - # Store the view |
157 | - view = response.view |
158 | + if task[0] == 1: |
159 | + manager = self.manager |
160 | + db = current.db |
161 | + request = current.request |
162 | + response = current.response |
163 | + errorString = "prepopulate error: file %s missing" |
164 | + # Store the view |
165 | + view = response.view |
166 | + |
167 | + auth = current.auth |
168 | + deployment_settings = auth.deployment_settings |
169 | |
170 | - auth = current.auth |
171 | - deployment_settings = auth.deployment_settings |
172 | - for job in self.importTasks: |
173 | - _debug ("Running job %s %s (filename=%s transform=%s)" % (job[0], job[1], job[2], job[3])) |
174 | - prefix = job[0] |
175 | - name = job[1] |
176 | + _debug ("Running job %s %s (filename=%s transform=%s)" % (task[1], task[2], task[3], task[4])) |
177 | + prefix = task[1] |
178 | + name = task[2] |
179 | tablename = "%s_%s" % (prefix, name) |
180 | if tablename in self.alternateTables: |
181 | details = self.alternateTables[tablename] |
182 | @@ -797,21 +802,21 @@ |
183 | # Skip the job if the target table doesn't exist |
184 | if tablename not in db: |
185 | self.errorList.append("WARNING: Unable to find table %s import job skipped" % tablename) |
186 | - continue |
187 | + return |
188 | # Check if the source file is accessible |
189 | try: |
190 | - csv = open(job[2], "rb") |
191 | + csv = open(task[3], "rb") |
192 | except IOError: |
193 | - self.errorList.append(sys.stderr, errorString % job[2]) |
194 | - break |
195 | + self.errorList.append(errorString % task[3]) |
196 | + return |
197 | # Check if the stylesheet is accessible |
198 | try: |
199 | - open(job[3], "rb") |
200 | + open(task[4], "rb") |
201 | except IOError: |
202 | - self.errorList.append(errorString % job[3]) |
203 | - break |
204 | + self.errorList.append(errorString % task[4]) |
205 | + return |
206 | # Create a request |
207 | - vars = dict(filename=job[2], transform=job[3]) |
208 | + vars = dict(filename=task[3], transform=task[4]) |
209 | r = manager.parse_request(prefix=prefix, |
210 | name=name, |
211 | args=["create.s3csv"], |
212 | @@ -820,16 +825,16 @@ |
213 | output = r() |
214 | db.commit() |
215 | _debug ("%s import job completed" % tablename) |
216 | - |
217 | - # Restore the view |
218 | - response.view = view |
219 | - self.clear_import_tasks() |
220 | - |
221 | - def execute_special_tasks(self): |
222 | - for task in self.specialTasks: |
223 | - fun = task[0] |
224 | - csv = task[1] |
225 | - extraArgs = task[2] |
226 | + |
227 | + # Restore the view |
228 | + response.view = view |
229 | + self.clear_import_tasks() |
230 | + |
231 | + def execute_special_task(self, task): |
232 | + if task[0] == 2: |
233 | + fun = task[1] |
234 | + csv = task[2] |
235 | + extraArgs = task[3] |
236 | if extraArgs == None: |
237 | stmt = "%s('%s')" % (fun, csv) |
238 | else: |
239 | @@ -845,8 +850,11 @@ |
240 | that are listed in the descriptor file |
241 | """ |
242 | self.load_descriptor(path) |
243 | - self.execute_special_tasks() |
244 | - self.execute_import_tasks() |
245 | + for task in self.tasks: |
246 | + if task[0] == 1: |
247 | + self.execute_import_task(task) |
248 | + elif task[0] == 2: |
249 | + self.execute_special_task(task) |
250 | |
251 | def perform_task(self, controller, csv, xsl): |
252 | """ convenience method that will load and execute the import job """ |
253 | |
254 | === modified file 'private/prepopulate/demo/LA/tasks.txt' |
255 | --- private/prepopulate/demo/LA/tasks.txt 2011-08-09 16:54:13 +0000 |
256 | +++ private/prepopulate/demo/LA/tasks.txt 2011-08-10 16:21:59 +0000 |
257 | @@ -14,6 +14,8 @@ |
258 | # zzz_1st_run |
259 | # s3Tools::S3BulkImporter |
260 | ########################################################################## |
261 | +*,self.manager.gis.import_csv,USA_L1.csv |
262 | +*,self.manager.gis.import_csv,California_L2.csv |
263 | "auth","user","users.csv","user.xsl" |
264 | "org","organisation","organisation.csv","organisation.xsl" |
265 | "org","office","office.csv","office.xsl" |
266 | @@ -24,5 +26,4 @@ |
267 | req,req_skill,req_skill.csv,req_skill.xsl |
268 | vol,application,vol_application.csv,application.xsl |
269 | vol,assignment,vol_application.csv,assignment.xsl |
270 | -*,self.manager.gis.import_csv,USA_L1.csv |
271 | -*,self.manager.gis.import_csv,California_L2.csv |
272 | +*,self.manager.s3.vol_application_onaccept_csv,req_req.csv |
273 | |
274 | === modified file 'tests/selenium/selenium-version' |
275 | --- tests/selenium/selenium-version 2011-02-04 21:46:18 +0000 |
276 | +++ tests/selenium/selenium-version 2011-08-10 16:21:59 +0000 |
277 | @@ -1,8 +1,8 @@ |
278 | -Installed version of selenium-server is 2.0a2 |
279 | +Installed version of selenium-server is 2.3.0 |
280 | - the directory has been renamed server |
281 | |
282 | Installed version of selenium-python-client is 1.0.1 |
283 | - file selenium.py has been copied to the script directory |
284 | |
285 | Installed version of HTMLTestRunner.py is 0.8.2 |
286 | -- file has been copied to the script directory |
287 | \ No newline at end of file |
288 | +- file has been copied to the script directory |
289 | |
290 | === removed file 'tests/selenium/server/selenium-server.jar' |
291 | Binary files tests/selenium/server/selenium-server.jar 2011-03-23 09:36:03 +0000 and tests/selenium/server/selenium-server.jar 1970-01-01 00:00:00 +0000 differ |
Please add the binary to the bzr ignore list - this will mean an uncommit 1st
- the repo has got huge & this very large binary really need removing rather than making it even bigger (this is what we do for the Google closure compiler.
A Raise if the .jar not found is just fine...a fancy script to auto-download can come later as-opportunity presents.
Yes please to avoid code duplication through nested calls.