sahana / eden

Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.. Please sign CLA when submitting pull requests: http://bit.ly/SSF-eCLA

Home Page:http://eden.sahanafoundation.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong link, too few mandatory fields and NoneType error in Assessment Targets (dc module)

trendspotter opened this issue · comments

Steps to reproduce:

  1. Log in on an instance with Assessments (dc) module enabled
  2. Go to Assessments -> Templates -> Create
  3. Create a new template, fill in only mandatory fields (name)
  4. Go to Assessments -> Targets -> Create
  5. Create a new target, fill in only mandatory fields (template from step 3)
  6. Click on Report

Problem 1)
Data Collection Target name should be mandatory. If not given, the target is called "None".

Problem 2)
Report href leads to /eden/dc/results?viewing=dc_target.1. This is presumably caused by the slash at the end of

(T("Report"), "results/"),

Problem 3)
After manually navigating to /eden/dc/target/1/results, error 500 with following traceback is produced

Traceback (most recent call last):
  File "/srv/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/srv/web2py/applications/eden/controllers/dc.py", line 200, in <module>
  File "/srv/web2py/gluon/globals.py", line 421, in <lambda>
    self._caller = lambda f: f()
  File "/srv/web2py/applications/eden/controllers/dc.py", line 133, in target
    return s3_rest_controller(rheader = s3db.dc_rheader,
  File "/srv/web2py/applications/eden/models/00_utils.py", line 245, in s3_rest_controller
    output = r(**attr)
  File "/srv/web2py/applications/eden/modules/s3/s3rest.py", line 688, in __call__
    output = handler(self, **attr)
  File "/srv/web2py/applications/eden/modules/s3/s3rest.py", line 1775, in __call__
    output = self.apply_method(r, **attr)
  File "/srv/web2py/applications/eden/modules/s3db/dc.py", line 1565, in apply_method
    output = self.html(r, title, **attr)
  File "/srv/web2py/applications/eden/modules/s3db/dc.py", line 1771, in html
    questions, stats = self._extract(r, **attr)
  File "/srv/web2py/applications/eden/modules/s3db/dc.py", line 1679, in _extract
    for posn in layout:
TypeError: 'NoneType' object is not iterable

//Edit: Note that the traceback is also mentioned at the end of report in #1543, but without steps to reproduce and without the other 2 errors mentioned above, hence the separate issue.

I will look at this, although note that the DC module isn't really usable in the default template (hence being moved to just Demo)...we /could/ re-enable the old Survey module as that does work, although isn't a good strategic tool as it was never too integrated into the rest of the system and can't be used on mobiles, etc.
What really need to happen for Default DC is to have the UCCE Editor back-ported to it....not a huge task but not trivial either...sponsorship welcomed ;)

Problem 1)
Data Collection Target name should be mandatory. If not given, the target is called "None".

I disagree...this is an optional field

Problem 2)
Report href leads to /eden/dc/results?viewing=dc_target.1. This is presumably caused by the slash at the end of

Correct, thanks, Fixed

Problem 3)
After manually navigating to /eden/dc/target/1/results, error 500 with following traceback is produced
for posn in layout:
TypeError: 'NoneType' object is not iterable

Thanks, Fixed...layout None is meaningless but we should catch the error gracefully.

Fixes in this commit:
81d40dc