Changeset 19479


Ignore:
Timestamp:
04/01/19 09:58:56 (6 years ago)
Author:
tbretz
Message:
Only enter a potential new source key if an observation is really scheduled.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/scheduler.cc

    r19468 r19479  
    576576            Info("A source with the same name (key="+to_string(source_key)+") was found in the Source table.");
    577577        }
    578 
     578/*
    579579        if (source_key<0)
    580580        {
     
    598598
    599599        }
    600 
     600*/
    601601        Out() << Time()-stopwatch << endl;
    602602
     
    784784        Info("Source will be scheduled.");
    785785
     786        if (source_key<0)
     787        {
     788            const string query =
     789                "INSERT INTO Source\n"
     790                " (fSourceName, fRightAscension, fDeclination, fWobbleAngle0, fWobbleAngle1, fSourceTypeKey, fIsToO) VALUES\n"
     791                " ('"+name+"', "+to_string(ra/15.)+", "+to_string(dec)+", "+to_string(wobble_angle-90)+", "+to_string(wobble_angle+90)+", 1, 1)";
     792
     793            if (!fDryRun)
     794            {
     795                auto q = fConnection.query(query);
     796                q.execute();
     797                Info(q.info());
     798
     799                source_key = q.insert_id();
     800
     801                Info(string(fDryRun?"[dry-run] ":"")+"The new source got the key "+to_string(source_key));
     802            }
     803            else
     804                Out() << query << endl;
     805
     806        }
     807
     808        Out() << Time()-stopwatch << endl;
     809
     810        // ====================================================================
     811
    786812        vector<string> insert;
    787813
Note: See TracChangeset for help on using the changeset viewer.