close

  
<p> var params = acre.request.params;

if (acre.request.method == 'POST')
{
    for (var key in acre.request.body_params)
        params[key] = acre.request.body_params[key];
}
  
if (params.call == 'pre')
    acre.write(JSON.stringify({"/people/person/date_of_birth": null,
                               "/people/deceased_person/date_of_death": null}));
else if (params.call == 'fetch')
{
    var args = JSON.parse(params.args);
    var _params = JSON.parse(params.params);
    var re = /(-?[0-9]{4})(-([0-9]{1,2})(-([0-9]{1,2}))?)?/;
    var results = {};
    var now = new Date();
    var age;
  
    for each (var mqlres in args) {
        var db = mqlres["/people/person/date_of_birth"];

        if (db != null)
        {
            var dd = mqlres["/people/deceased_person/date_of_death"];
      
            if (dd != null)
            {
                var mdd = re.exec(dd);
                if (mdd == null)
                    continue;
                var mdd_month = mdd[3]; 
                var mdd_day = mdd[5];
              
                var mdb = re.exec(db);
                if (mdb == null)
                    continue;
                var mdb_month = mdb[3];
                var mdb_day = mdb[5];
              
                age = parseInt(mdd[1], 10) - parseInt(mdb[1], 10);
                if (mdd_month != null &amp;&amp; mdb_month != null)
                {
                    mdd_month = parseInt(mdd_month, 10);
                    mdb_month = parseInt(mdb_month, 10);
                    if (mdd_month == mdb_month)
                    {
                        if (mdd_day != null &amp;&amp; mdb_day != null)
                        {
                            mdd_day = parseInt(mdd_day, 10);
                            mdb_day = parseInt(mdb_day, 10);
                            if (mdd_day = arg)
                              ok = false;
                          break;
                      case " arg)
                              ok = false;
                          break;
                      case "&gt;":
                          if (age =":
                          if (age </p>

Comments

Hide