Skip to content

Commit

Permalink
Merge branch 'reference_year'
Browse files Browse the repository at this point in the history
  • Loading branch information
randrescastaneda committed Sep 2, 2020
2 parents f8e7e0a + d8a824e commit c2f9b12
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 169 deletions.
18 changes: 8 additions & 10 deletions povcalnet.ado
Original file line number Diff line number Diff line change
Expand Up @@ -235,21 +235,19 @@ qui {
}

if ("`server'" == "") {
noi disp in red "You don't have access to internal servers"
error
noi disp in red "You don't have access to internal servers" _n /*
*/ "You're being redirected to public server"
local server "http://iresearch.worldbank.org/PovcalNet"
}

local base = "`server'/PovcalNetAPI.ashx"
}
}
else {
local serveri = "http://iresearch.worldbank.org"
local site_name = "PovcalNet"
local handler = "PovcalNetAPI.ashx"
local base = "`serveri'/`site_name'/`handler'"
local server "http://iresearch.worldbank.org/PovcalNet"
}

return local server = "`serveri'`server'"
return local site_name = "`site_name'"
local base = "`server'/PovcalNetAPI.ashx"
return local server = "`server'"


*---------- lower case subcommand
local subcommand = lower("`subcommand'")
Expand Down
154 changes: 0 additions & 154 deletions povcalnet_aggquery.ado

This file was deleted.

18 changes: 13 additions & 5 deletions povcalnet_query.ado
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,32 @@ quietly {
local region = upper("`region'")

*---------- Make sure at least one reference year is selected

if ("`year'" != "all" & ("`wb'" != "" | "`aggregate'" != "")) {
local ref_years 1981 1984 1987 1990 1993 1996 1999 2002 2005 2008 2010 2011 2012 2013 2015 last
local page "`server'/js/common_NET.js"
scalar page = fileread(`"`page'"')
scalar page = subinstr(page, `"""', "",.)

if regexm(page, "var AllRefYears = \[([^;]+)\]") local ref_years_l = regexs(1)
local ref_years_l "`ref_years_l', last"

local ref_years_l: subinstr local ref_years " " ",", all
local ref_years: subinstr local ref_years_l ", " " ", all

local no_ref: list year - ref_years

if (`: list no_ref === year') {
noi disp as err "Not even one of the years select belong to reference years: `ref_years_l'"
noi disp as err "Not even one of the years select belong to the following reference years: " _n /*
*/ " `ref_years_l'"
error
}

if ("`no_ref'" != "") {
noi disp in y "Warning: `no_ref' is/are not part of reference years: `ref_years_l'"
}
}




***************************************************
* 1. Will load guidance database
***************************************************
Expand Down

0 comments on commit c2f9b12

Please sign in to comment.