Ejemplo n.º 1
0
 def list_iids(self):
     self.parent.check_auth()
     template = JINJA.get_template('list_iids.template')
     table = from_db_cursor(self.get_cursor("""select local_iid as iid, ra, decl, 
                                                      string_agg(fs.set_id, ',') as sets,
                                                      string_agg(fp.catalog || '(' || cast(fp.objects_count as character varying) || ')', ',') as catalogs                                                         
                                                 from fields f 
                                                 left outer join fields_properties fp on fp.iid = f.iid
                                                 left outer join field_sets fs on fs.iid = f.iid
                                                where user_id = '%s' 
                                               group by 1,2,3
                                               order by 2
                                                 """ % self.parent.current_user))
     data = self.parent.get_basic()
     data['iid_list'] = table.get_html_string(attributes={'border': 1,
                                                          'id': 'iid_table'})
     return template.render(data)
Ejemplo n.º 2
0
 def single_iid(self, iid):
     self.parent.check_auth()
     global_iid = self.parent.runner.get_global_iid(self.parent.current_user, iid)
     cur = self.get_cursor("""select catalog, objects_count, peaks_count, loading_date
                                from fields_properties
                               where iid = %s""" % global_iid)
     data = self.parent.get_basic()
     data.update({'catalogs': [], 
                  'iid': iid})
     for row in cur.fetchall():
         data['catalogs'].append({'name': row[0],
                                  'objects_count': row[1],
                                  'peaks_count': row[2],
                                  'loading_date': row[3]})
     detections = from_db_cursor(self.get_cursor("""
         select detection_id, z, z_err, lambda, bcg_distance 
           from cluster_detections
          where iid = %s""" % global_iid))
     data['detections'] = detections.get_html_string(attributes={'border': 1,
                                                          'id': 'detections'})
     template = JINJA.get_template('single_iid.template')
     return template.render(data)