IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 22, 2006, 12:20:30 AM (20 years ago)
Author:
jhoblitt
Message:

updated -done logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/chiptool.c

    r6163 r6170  
    154154static bool doneMode(p2Config *config)
    155155{
    156   // get exp_id/class/class_id/url from the CLI
    157   // add the completed imfile to the p2DoneImfile tables
    158   // remove corresponding entries from the p2PendingImfile table
    159   // check to see if any p2PendingExps have no associated p2PendingImfiles
    160   //    if so move the p2PendingExp(s) to p2DoneExp
     156    // get exp_id/class/class_id/url from the CLI // add the completed imfile to
     157    // the p2DoneImfile tables // remove corresponding entries from the
     158    // p2PendingImfile table // check to see if any p2PendingExps have no
     159    // associated p2PendingImfiles //    if so move the p2PendingExp(s) to
     160    // p2DoneExp
    161161
    162162    // find pending
     
    181181    }
    182182
     183    // look for pending exposures
     184    psArray *pendingExps = p2searchPendingExp(config);
     185    if (!pendingExps) {
     186        psError(PS_ERR_UNKNOWN, false, "no p2PendingExps found");
     187        return false;
     188    }
     189
     190    for (int i = 0; i < pendingExps->n; i++) {
     191        p2PendingExpRow *pendingExp = pendingExps->data[i];
     192
     193        psMetadata *where = psMetadataAlloc();
     194        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", pendingExp->exp_id);
     195        psArray *pendingImfiles = p2PendingImfileSelectRowObjects(config->database, where, MAX_ROWS);
     196        psFree(where)
     197        if (!pendingImfiles) {
     198            // exp has no coresponding imfiles
     199            psArray *nukeMe = psArrayAlloc(1);
     200            nukeMe->n = 0;
     201            psArrayAdd(nukeMe, 0, pendingExp);
     202            bool status = p2PendingExpDeleteRowObjects(config->database, nukeMe, MAX_ROWS);
     203            psFree(nukeMe);
     204            if (!status) {
     205                psError(PS_ERR_UNKNOWN, false, "database access failed");
     206                return false;
     207            }
     208            // XXX need a func to convert from p2PendingExp -> p2DoneExp
     209
     210            p2DoneExpRow *doneExp = p2pendingToDoneExp(pendingExp);
     211            if (!doneExp) {
     212                psError(PS_ERR_UNKNOWN, false, "p2PendingExp -> p2DoneExp failed");
     213                return false;
     214            }
     215            if (!p2DoneExpInsertObject(config->database, doneExp)) {
     216                psError(PS_ERR_UNKNOWN, false, "database access failed");
     217                return false;
     218            }
     219        }
     220        // skip phase 3 for the time being
     221        psFree(pendingImfiles);
     222    }
    183223
    184224    /*
Note: See TracChangeset for help on using the changeset viewer.