iurisampaio

Untitled

Oct 22nd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 10.36 KB | None | 0 0
  1. list::create \
  2.     -name items \
  3.     -multirow items \
  4.     -key item_id \
  5.     -page_flush_p 1 \
  6.     -page_size 250 \
  7.     -page_query_name select_items \
  8.     -actions {
  9.         "#evex-event.Send_request#" request-proposal "#evex-event.Send_a_request_to_partner#"
  10.     } \
  11.     -bulk_action_method post \
  12.     -bulk_action_export_vars { event_id } \
  13.     -bulk_actions {
  14.         "#evex-event.Send_request#" request-proposal "#evex-event.Send_request_to_all_partners#"
  15.     } \
  16.     -elements {
  17.         title {
  18.             label "#evex-event.Title#"
  19.         }
  20.         distance {
  21.             label "#evex-event.Distance#"
  22.         }
  23.         score {
  24.             label "#evex-event.Category_Score#"
  25.         }
  26.         total {
  27.             label "#evex-event.Total_Score#"
  28.         }
  29.         location {
  30.             label "#evex-event.Location#"
  31.         }
  32.     }
  33.  
  34. db_multirow -extend { location thumbnail_url} items select_items_page "                                                                                                                                                                                                                                                                                              
  35.    SELECT qa1.item_id, qa1.score AS total, qa2.score, cr.title,                                                                                                                                                                                                                                                                                                    
  36.    pa.latitude, pa.longitude, pa.delivery_address AS location,                                                                                                                                                                                                                                                                                                      
  37.    to_char((( 3959 * acos ( cos ( radians(:latitude) ) * cos( radians( CAST(pa.latitude AS NUMERIC)) ) * cos( radians( CAST(pa.longitude AS NUMERIC) ) - radians(:longitude) )+ sin ( radians(:latitude) )* sin( radians( CAST(pa.latitude AS NUMERIC) ) ) )) * 1.6)::float, 'FM999999990.00') AS distance                                                          
  38.    FROM                                                                                                                                                                                                                                                                                                                                                            
  39.    cr_items ci, cr_revisions cr,                                                                                                                                                                                                                                                                                                                                    
  40.    ee_qa_item_info qa1, ee_qa_item_category_score qa2,                                                                                                                                                                                                                                                                                                              
  41.    postal_addresses pa,                                                                                                                                                                                                                                                                                                                                            
  42.    acs_data_links adl                                                                                                                                                                                                                                                                                                                                              
  43.    WHERE ci.item_id = cr.item_id                                                                                                                                                                                                                                                                                                                                    
  44.    AND ci.live_revision = cr.revision_id                                                                                                                                                                                                                                                                                                                            
  45.    AND (ci.content_type = 'ee_venue' OR ci.content_type = 'ee_service')                                                                                                                                                                                                                                                                                            
  46.    AND qa1.item_id = ci.item_id                                                                                                                                                                                                                                                                                                                                    
  47.    AND qa1.item_id = qa2.item_id                                                                                                                                                                                                                                                                                                                                    
  48.    AND adl.object_id_one = qa1.item_id                                                                                                                                                                                                                                                                                                                              
  49.    AND adl.object_id_two = pa.party_id                                                                                                                                                                                                                                                                                                                              
  50.    AND adl.relation_tag = 'item_group_rel'                                                                                                                                                                                                                                                                                                                          
  51.                                                                                                                                                                                                                                                                                                                                                                    
  52.    AND (( 3959 * acos ( cos ( radians(:latitude) ) * cos( radians( CAST(pa.latitude AS NUMERIC)) ) * cos( radians( CAST(pa.longitude AS NUMERIC) ) - radians(:longitude) )+ sin ( radians(:latitude) )* sin( radians( CAST(pa.latitude AS NUMERIC) ) ) )) * 1.6) < :max_distance                                                                                    
  53.                                                                                                                                                                                                                                                                                                                                                                    
  54.    AND ci.item_id IN ($item_ids)                                                                                                                                                                                                                                                                                                                                    
  55.    AND qa2.category_id IN ($categories)                                                                                                                                                                                                                                                                                                                            
  56.    AND [template::list::page_where_clause -name items -key qa1.item_id ]                                                                                                                                                                                                                                                                                            
  57.    [template::list::filter_where_clauses -and -name items]                                                                                                                                                                                                                                                                                                          
  58.    GROUP BY qa1.item_id, qa2.score, cr.title, pa.latitude, pa.longitude, pa.delivery_address                                                                                                                                                                                                                                                                        
  59.    ORDER BY qa2.score DESC, qa1.score DESC                                                                                                                                                                                                                                                                                                                          
  60.                                                                                                                                                                                                                                                                                                                                                                    
  61. " {
  62.  
  63.     set thumbnail_url ""
  64. ...
  65. }
Add Comment
Please, Sign In to add comment