e00cb63405632c064e4228a97139b56d05274c82 braney Wed Nov 14 16:50:09 2012 -0800 fix bug in keeping track of error message introduced last cycle (#9609). Also fix bug in unlisted hubs where assembly was listed incorrectly. diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index dd0ff6a..4cf21fc 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -55,101 +55,80 @@ ourCellEnd(); } static char *removeLastComma(char *string) { if (string != NULL) { int len = strlen(string); if ( string[len - 1] == ',') string[len - 1] = 0; } return string; } -static void addGenomesToHash(struct hubConnectStatus *hub, struct hash *hash) -/* add supported assembly names from trackHub to hash */ -{ -if (hub == NULL) - return; - -struct trackHub *thub = hub->trackHub; -if (thub != NULL) +static void printGenomes(struct trackHub *thub) +/* print supported assembly names from trackHub */ { /* List of associated genomes. */ struct trackHubGenome *genomes = thub->genomeList; +struct dyString *dy = newDyString(100); for(; genomes; genomes = genomes->next) - hashStore(hash, genomes->name); - } + dyStringPrintf(dy,"%s,", genomes->name); +ourPrintCell(removeLastComma( dyStringCannibalize(&dy))); } static void hgHubConnectUnlisted(struct hubConnectStatus *hubList, struct hash *publicHash) /* Put up the list of unlisted hubs and other controls for the page. */ /* uses publicHash to distingusih public hubs from unlisted ones */ /* NOTE: Destroys hubList */ { // put out the top of our page printf("
\n" " \n" " \n" " \n" " \n"); // count up the number of unlisted hubs we currently have int unlistedHubCount = 0; struct hubConnectStatus *unlistedHubList = NULL; struct hubConnectStatus *hub, *nextHub; -struct hash *assHash = newHash(5); for(hub = hubList; hub; hub = nextHub) { nextHub = hub->next; // if url is not in publicHash, it's unlisted */ if (!((publicHash != NULL) && hashLookup(publicHash, hub->hubUrl))) { - addGenomesToHash(hub, assHash); unlistedHubCount++; slAddHead(&unlistedHubList, hub); } } hubList = NULL; // hubList no longer valid -struct hashCookie cookie = hashFirst(assHash); -struct dyString *dy = newDyString(100); -struct hashEl *hel; -int numAssemblies = 0; -while ((hel = hashNext(&cookie)) != NULL) - { - dyStringPrintf(dy,"%s,", hel->name); - numAssemblies++; - } - -char *dbList = NULL; -if (numAssemblies) - dbList = dyStringCannibalize(&dy); - if (unlistedHubCount == 0) { // nothing to see here printf(""); printf("
\n" " \n" "\n" "
No Unlisted Track Hubs
"); return; } // time to output the big table. First the header printf( " " "Display " "Hub Name " "Description " "Assemblies " @@ -191,31 +170,34 @@ } if (hub->trackHub != NULL) ourPrintCell(hub->trackHub->shortLabel); else ourPrintCell(""); if (!isEmpty(hub->errorMessage)) printf("ERROR: %s " "Debug\n", hub->errorMessage); else if (hub->trackHub != NULL) ourPrintCell(hub->trackHub->longLabel); else ourPrintCell(""); - ourPrintCell(removeLastComma(dbList)); + if (hub->trackHub != NULL) + printGenomes(hub->trackHub); + else + ourPrintCell(""); ourPrintCell(hub->hubUrl); ourCellStart(); printf( "\n" , hub->id); ourCellEnd(); } printf("\n"); printf(""); }