返回顶部

收藏

优化查询查找

更多
getExemptionBoard :  function(documentid){
            var ex = new ExemptionBoard();
            var exemptions = horton.exempt.getExemptionInfo(documentid);
                ex.exemptions = exemptions; //do length check
                ex.locations = horton.services.locationService.getAllItems() ;
                var profile = new PageDataManager("profile",documentid); 

                //Get all the ExemptionLocations and add them as needed, rather than a query for each since we are opening and closing connections:

                var tempExemtLocations =  quickQuery("SELECT Location_Amt, Position_ID, Location_ID FROM PHD_MM_ExemptionsLocations WHERE Document_ID = ?",  [documentid]);

                for(var i = 0; i < ex.exemptions.length; i++){
                    ex.exemptions[i].profile = profile;
                    ex.exemptions[i].locations = [];
                    for(var l = 0; l < ex.locations.length; l++){
                        var exemptionInfo = {}
                            exemptionInfo.location = ex.locations[l];
                            exemptionInfo.location_id = ex.locations[l].location_id;
                                exemptionInfo.exempt_val = 0;
                            //Go find the right one in the previous array

                            for(var e = 0; e < tempExemtLocations.length; e++){
                                if((tempExemtLocations[e].location_id == ex.locations[l].location_id) && (tempExemtLocations[e].position_id == i+1)){
                                        exemptionInfo.exempt_val =  tempExemtLocations[e].location_amt; 
                                        break; //Found it, done.
                                }
                            }

                        ex.exemptions[i].locations.push(exemptionInfo); //We go and get the ExemptionLocation Value
                    }
                }               
            return ex;
        },

标签:javascript

收藏

0人收藏

支持

0

反对

0

相关聚客文章
  1. K-Res 发表 2018-10-27 12:10:11 关于Javascript中类成员函数中内嵌函数的this闭包问题
  2. 杨魁 发表 2018-10-25 07:28:13 Under the Hood: NaN of JS
  3. 尖兵 发表 2018-10-25 11:03:47 服务重启导致的Java服务抖动CPU占用高
  4. 可乐加糖 发表 2018-10-23 08:31:16 JavaScript文档生成器JSDuck
  5. 可乐加糖 发表 2018-10-23 08:31:16 JavaScript文档生成器JSDuck
  6. wenming.gapo 发表 2018-10-23 11:32:30 AOP装饰函数与小T的情愫(二)
  7. 尖兵 发表 2018-10-18 13:19:02 Java诊断工具Arthas
  8. 尖兵 发表 2018-10-18 13:19:02 Java诊断工具Arthas
  9. hellas 发表 2018-10-18 14:20:31 AOP装饰函数与小T的情愫
  10. 博主 发表 2018-10-15 10:02:38 生成聚合收款二维码:支付宝、微信、QQ 钱包
  11. axiu 发表 2018-10-14 02:30:40 微信小程序开发总结
  12. xirruiqiang 发表 2018-10-14 08:14:43 round 函数在不同语言中的实现乱象

发表评论