1 (edited by dieter 29-11-2014 14:24:07)

Topic: My records

Hi again!

I'm still having troubles with the my records page! I'm trying the code suggested on 'http://forums.nbn.org.uk/viewtopic.php?id=5461' but it does not give me any output, exept a blank grid and map. What am I doing wrong? Some ID i have to edit? I just want the users to view there own records. I'm using the latest svn warehouse and Drupal 7 with latest modules.

2

Re: My records

Hi Dieter
Can I check - do you have the "Easy login" feature enabled?
Regards
John

John van Breda
Biodiverse IT

3

Re: My records

Yes, and the user is created in the warehouse. ;)

4

Re: My records

So what are the other options to try? To summarize: I added in the warehouse the CMS user id block to the survey. I'm logged in on Drupal 7 with the user created with Easy Login feature. I created a record/sighting. The add picture button does not work for the record. It doesn't open the explorer screen (as I noticed before in my other topic)!  Then I check in the warehouse if the record was created. Then I created the 'My records' page, and then it does't give me an output... I can take printscreens if nescessary.

5

Re: My records

Hi there,
I don't know if this is related or if it really should be a different topic as I'm still on Drupal 6. Some of my users who are using Internet Explorer in compatibility mode cannot see the My Records report. Just a blank area where the map should be and several empty grids (I assume these are grids that ordinarily would display on the 'Records' 'Species' 'Taxon groups' etc. tabs).
I've checked on iRecord in IE compatibility mode  amd while the map, tabs and records grid shows, the Create a filter function doesn't. I would be interested to know what is controlling the visibility of these features - is it simply down to the CSS not coping the IE in compatibility mode?
Thanks,
Fiona

PS our users in government have no choice on the browser they use which means I need to solve this. If someone else has already solved it, it will take me a lot less time to figure out the solution specific to our site.

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

6

Re: My records

Hi Fiona,

It's not related since I use chrome and the map does show, but just no output. I will take some screenshots to make my case clear.

Dieter

7

Re: My records

Thanks Dieter, I'll move mine to a new topic :)
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

8

Re: My records

Hi Dieter

I know very little about the My Records page and obviously nothing about your warehouse configuration.
However, if you have copied over settings such as the following, which vary from one warehouse to another, they could very easily cause you problems.

@taxon_list_id=15
@indexedLocationTypeIds=[15,1370]
@otherLocationTypeIds=[2412,2188]

Jim Bacon.

9

Re: My records

Hi Jim,

I already tried to remove these, because I found it logic that it could cause problems. But if I just remove it, I have the same result.

Dieter

10

Re: My records

Hi Dieter,

I tried removing these too and I still get records showing. Have you changed the Form Structure in other ways?

Are there any errors in the warehouse log?
If you set the debug level to 4 in the warehouse config files it will log the queries being executed when you visit the My Records page.
Sometimes when you look at the query that is actually running the problem becomes obvious.

Jim Bacon.

11

Re: My records

I will try the debug level this weekend. Thanks for your reply.

Dieter

12

Re: My records

I find it helpful when trying to understand a problem like this to copy and paste the query in to the SQL editor of pgAdmin and systematically delete 'wheres' and 'joins' to find out which part of the query is filtering out results.

Jim Bacon.

13 (edited by dieter 06-12-2014 19:44:02)

Re: My records

Tried debugging mode, copied this part of the output of the log in pgadmin and run the query:

SELECT array_to_string(array_agg(o.id), ',') as occurrence_ids,
array_to_string(array_agg(distinct o.taxon_meaning_id), ',') as taxon_meaning_ids,
st_astext(msq.geom) as geom
  FROM cache_occurrences o
  JOIN websites w on w.id=o.website_id and w.deleted=false
  JOIN users privacyusers ON privacyusers.id=o.created_by_id
  
JOIN map_squares msq on msq.id=o.map_sq_10km_id and msq.size=10000

  WHERE (o.training=false OR o.training IS NULL) AND (o.website_id in (2) OR privacyusers.allow_share_for_reporting=true OR privacyusers.allow_share_for_reporting IS NULL)
AND o.website_id in (2) 
  
  AND (o.release_status='R' or o.release_status is null)
AND st_intersects(msq.geom, st_geomfromtext('POLYGON((324065.82225849 6341890.4077558,745998.21833393 6341890.4077558,745998.21833393 6708788.1434736,324065.82225849 6708788.1434736,324065.82225849 6341890.4077558))', 900913))
AND o.created_by_id=3
AND o.record_status<>'R'

GROUP BY st_astext(msq.geom) LIMIT 2000

Output:
ERROR:  relation "cache_occurrences" does not exist
LINE 4:   FROM cache_occurrences o
               ^

********** Error **********

ERROR: relation "cache_occurrences" does not exist
SQL state: 42P01
Character: 183

14

Re: My records

Hi

If your installation is like mine, in pgAdmin, when you expand the list of schemas there will be one called indicia and, if you expand its list of tables there will be one called cache_occurrences.

If you can see that then you know that the table does exist. Almost certainly the problem is the search path that postgres is using to locate the table.

If you execute the sql command

show search_path

and the indicia schema is not in the list then you need to add it.
You can add it on a per session basis by executing

set search_path = indicia, public;

or you can make that the default by setting it in the postgresql.conf file.

You can always qualify table names with their schema name if you prefer but that soon gets tiresome.

Jim Bacon.

15

Re: My records

The query runs now but again no output. In the messages tab of pgAdmin I get: 0 rows retrieved.  However, I can see my record in the warehouse under the Entered data tab. Strange...

16 (edited by Jim Bacon 09-12-2014 09:32:06)

Re: My records

Hi

Great. Now what you can do is run the query again and again, each time with a different bit of the WHERE deleted. Something is filtering out your record and you'll be able to say which part it is.

E.g if you remove the line

AND o.created_by_id=3

and suddenly your record is returned by the query then that tells you that the record was created by a different user from the one requesting the report which would explain why it is not showing up.

Jim Bacon.

Note, it might be a JOIN causing the problem as well, e.g if there were no records in the map_squares table.

17

Re: My records

Solved!!!!!  =D
It had nothing to do with the query...
The problem was in the cache being empty! I googled the cache_occurences for indicia and bumped on this page: 'http://indicia-docs.readthedocs.org/en/ … ilder.html' and I directed my warehouse to localhost/indicia/index.php/scheduled_tasks?force_cache_rebuild. So the next question rises. How can I make my warehouse do this automatically?

18

Re: My records

Ahah!!!
That would explain it! Congratulations.
Have a look at http://indicia-docs.readthedocs.org/en/ … asks.html. It should answer your question.

Jim Bacon.