浏览代码

修复一个bug

Joey 4 月之前
父节点
当前提交
e2b38c299b
共有 1 个文件被更改,包括 10 次插入8 次删除
  1. 10 8
      modules/rankingCalculator.dos

+ 10 - 8
modules/rankingCalculator.dos

@@ -192,6 +192,8 @@ def run_ranking_sql(ranking_by, mutable data_table, indicator_table) {
 /*
  *   为排名做数据准备
  *   
+ *   TODO: 对少量组合做优化
+ *   
  *   @return <VECTOR>: 包含两个表,一个指标数据表,一个是指标信息表
  *   
  */
@@ -217,14 +219,6 @@ def prepare_data_for_ranking(ranking_by, entity_type, entity_info, end_date, isF
 
 	if(ranking_by == 'bfi') {
 
-		// bfi table
-		table_desc = get_bfi_by_category_group_table_description(entity_type);
-		tb_bfi = get_monthly_indicator_data(table_desc.table_name[0], end_date, isFromMySQL);
-
-		// bfi (as benchmark) indicator
-		table_desc = get_bfi_indicator_table_description(entity_type);
-		tb_data_bfi_indicator = get_monthly_indicator_data(table_desc.table_name[0], end_date, isFromMySQL);
-
         // 去掉被移到 fund_ty_bfi_bm_indicator 表中的重复字段
         v_dups = [38, 48, 11, 12, 59, 16];
         v_dup_col = EXEC name + suffix
@@ -233,6 +227,14 @@ def prepare_data_for_ranking(ranking_by, entity_type, entity_info, end_date, isF
         
         tb_data.dropColumns!(v_dup_col);
 
+		// bfi table
+		table_desc = get_bfi_by_category_group_table_description(entity_type);
+		tb_bfi = SELECT portfolio_id, end_date, factor_id FROM get_monthly_indicator_data(table_desc.table_name[0], end_date, isFromMySQL);
+
+		// bfi (as benchmark) indicator
+		table_desc = get_bfi_indicator_table_description(entity_type);
+		tb_data_bfi_indicator = get_monthly_indicator_data(table_desc.table_name[0], end_date, isFromMySQL);
+
 		matchingCols2 = [entity_id_name, 'end_date', 'factor_id'];
 		tb_data = lj(ej(tb_data, tb_bfi, matchingCols), tb_data_bfi_indicator, matchingCols2);