4886584b86a25443a2bd4b5d2816001775f9cab5
braney
  Fri Sep 16 17:04:22 2011 -0700
don't show myHubs that don't support the current assembly #5253
diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index b6ea4d3..d442349 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -119,30 +119,41 @@
     hub->id = sqlUnsigned(row[0]);
     hub->shortLabel = cloneString(row[1]);
     hub->longLabel = cloneString(row[2]);
     hub->hubUrl = cloneString(row[3]);
     hub->errorMessage = cloneString(row[4]);
     hub->dbCount = sqlUnsigned(row[5]);
     int sizeOne;
     sqlStringDynamicArray(row[6], &hub->dbArray, &sizeOne);
     assert(sizeOne == hub->dbCount);
     hub->status = sqlUnsigned(row[7]);
     }
 sqlFreeResult(&sr);
 return hub;
 }
 
+boolean hubHasDatabase(struct hubConnectStatus *hub, char *database) 
+/* Return TRUE if hub has contents for database */
+{
+int ii;
+
+for(ii=0; ii < hub->dbCount; ii++)
+    if (sameString(hub->dbArray[ii], database))
+	return TRUE;
+return FALSE;
+}
+
 boolean isHubUnlisted(struct hubConnectStatus *hub) 
 /* Return TRUE if it's an unlisted hub */
 {
     return (hub->status & HUB_UNLISTED);
 }
 
 struct hubConnectStatus *hubConnectStatusForId(struct sqlConnection *conn, int id)
 /* Given a hub ID return associated status. Returns NULL if no such hub.  If hub
  * exists but has problems will return with errorMessage field filled in. */
  /* If the id is negative, then the hub is private and the number is the
   * offset into the private hubfile in the trash */
 {
 struct hubConnectStatus *hub = NULL;
 
 hub = hubConnectStatusForIdDb(conn, id);
@@ -366,31 +377,31 @@
 
     char *thisId = row[0], *thisError = row[1];
 
     if (!isEmpty(thisError))
 	*errorMessage = cloneString(thisError);
 
     id = sqlUnsigned(thisId);
     }
 sqlFreeResult(&sr);
 
 hDisconnectCentral(&conn);
 
 return id;
 }
 
-static boolean hubHasDatabase(unsigned id, char *database)
+static boolean hubIdHasDatabase(unsigned id, char *database)
 /* check to see if hub specified by id supports database */
 {
 struct sqlConnection *conn = hConnectCentral();
 char query[512];
 
 safef(query, sizeof(query), "select dbList from %s where id=%d", 
     hubStatusTableName, id); 
 char *dbList = sqlQuickString(conn, query);
 boolean gotIt = FALSE;
 
 if (nameInCommaList(database, dbList))
     gotIt = TRUE;
 
 hDisconnectCentral(&conn);
 
@@ -440,31 +451,31 @@
 
 static unsigned getAndSetHubStatus(char *database, struct cart *cart, char *url, 
     boolean set, boolean unlisted)
 /* look in the hubStatus table for this url, add it if it isn't in there
  * Set the cart variable to turn the hub on if set == TRUE.  
  * Return id from that status table*/
 {
 char *errorMessage = NULL;
 unsigned id;
 
 if ((id = getHubId(url, &errorMessage)) == 0)
     {
     if ((id = fetchHub(database, url, unlisted)) == 0)
 	return id;
     }
-else if (!hubHasDatabase(id, database))
+else if (!hubIdHasDatabase(id, database))
     {
     warn("requested hub at %s does not have data for %s\n", url, database);
     return id;
     }
 
 char hubName[32];
 safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, id);
 if (set)
     cartSetString(cart, hubName, "1");
 
 return id;
 }
 
 unsigned hubFindOrAddUrlInStatusTable(char *database, struct cart *cart,
     char *url, char **errorMessage)