7339d9619c68e0758518c78e0b3564a03c3d7835
jcasper
Wed Jun 8 12:06:09 2016 -0700
Fix for flawed attempt at counting custom tracks, refs #17476
diff --git src/hg/hgSession/hgSession.c src/hg/hgSession/hgSession.c
index 7d7facf..c39177e 100644
--- src/hg/hgSession/hgSession.c
+++ src/hg/hgSession/hgSession.c
@@ -881,46 +881,45 @@
/* Show details about a particular session. */
{
if (userName == NULL)
return "Sorry, please log in again.";
struct dyString *dyMessage = dyStringNew(4096);
char *encSessionName = cgiEncodeFull(sessionName);
char *encUserName = cgiEncodeFull(userName);
struct sqlConnection *conn = hConnectCentral();
struct sqlResult *sr = NULL;
char **row = NULL;
char query[512];
webPushErrHandlersCartDb(cart, cartUsualString(cart, "db", NULL));
boolean gotSettings = (sqlFieldIndex(conn, namedSessionTable, "settings") >= 0);
if (gotSettings)
- sqlSafef(query, sizeof(query), "SELECT shared, firstUse, contents, settings from %s "
+ sqlSafef(query, sizeof(query), "SELECT shared, firstUse, settings from %s "
"WHERE userName = '%s' AND sessionName = '%s'",
namedSessionTable, encUserName, encSessionName);
else
- sqlSafef(query, sizeof(query), "SELECT shared, firstUse contents from %s "
+ sqlSafef(query, sizeof(query), "SELECT shared, firstUse from %s "
"WHERE userName = '%s' AND sessionName = '%s'",
namedSessionTable, encUserName, encSessionName);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL)
{
int shared = atoi(row[0]);
char *firstUse = row[1];
- char *contents = row[2];
char *settings = NULL;
if (gotSettings)
- settings = row[3];
+ settings = row[2];
char *description = getSetting(settings, "description");
if (description == NULL) description = "";
dyStringPrintf(dyMessage, "Session Details Help
\n");
#define highlightAccChanges " var b = document.getElementById('" hgsDoSessionChange "'); " \
" if (b) { b.style.background = '#ff9999'; }"
#define toggleGalleryDisable \
" var c = document.getElementById('detailsSharedCheckbox'); " \
" var d = document.getElementById('detailsGalleryCheckbox'); " \
" if (c.checked)" \
" {d.disabled = false;} " \
" else" \
@@ -954,89 +953,36 @@
highlightAccChanges, toggleGalleryDisable, highlightAccChanges, toggleGalleryDisable,
cgiBooleanShadowPrefix(), hgsSharePrefix, encSessionName);
dyStringPrintf(dyMessage,
"List in Public Sessions? \n"
"
\n",
hgsGalleryPrefix, encSessionName, (shared>=2 ? " CHECKED" : ""),
highlightAccChanges, highlightAccChanges,
cgiBooleanShadowPrefix(), hgsGalleryPrefix, encSessionName);
/* Set initial disabled state of the gallery checkbox */
dyStringPrintf(dyMessage, "\n\n", toggleGalleryDisable);
dyStringPrintf(dyMessage,
"Created on %s.
\n", firstUse);
/* Print custom track counts per assembly */
- if (startsWith("ctfile_", contents) || (strstr(contents, "&ctfile_") != NULL))
- {
- char *splitContents = cloneString(contents);
- subChar(splitContents, '&', ' ');
- struct hash *contentsHash = hashFromString(splitContents);
- struct hash *ctValidCount = hashNew(2);
- struct hash *ctInvalidCount = hashNew(2);
- struct hashEl *elList = hashElListHash(contentsHash), *thisEl = elList;
- while (thisEl != NULL)
- {
- if (startsWith("ctfile_", thisEl->name))
- {
- char *db = thisEl->name + 7;
- char *ctFile = cloneString(thisEl->val);
- cgiDecode(ctFile,ctFile,strlen(ctFile));
- if (!fileExists(ctFile))
- {
- if (hashFindVal(ctInvalidCount, db) == NULL)
- hashAddInt(ctInvalidCount, db, 1);
- else
- hashIncInt(ctInvalidCount, db);
- }
- else
- {
- if (hashFindVal(ctValidCount, db) == NULL)
- hashAddInt(ctValidCount, db, 1);
- else
- hashIncInt(ctValidCount, db);
- }
- }
- thisEl = thisEl->next;
- }
- elList = hashElListHash(ctValidCount);
- if (elList != NULL)
- {
- dyStringPrintf(dyMessage, "Custom track counts per assembly: %s (%d)",
- elList->name, ptToInt(elList->val));
- thisEl = elList->next;
- while (thisEl != NULL)
- {
- dyStringPrintf(dyMessage, ", %s (%d)", thisEl->name, ptToInt(thisEl->val));
- thisEl = thisEl->next;
- }
- dyStringPrintf(dyMessage, "
\n");
- }
- elList = hashElListHash(ctInvalidCount);
- if (elList != NULL)
- {
- dyStringPrintf(dyMessage, "Expired custom track counts per assembly: %s (%d)",
- elList->name, ptToInt(elList->val));
- thisEl = elList->next;
- while (thisEl != NULL)
- {
- dyStringPrintf(dyMessage, ", %s (%d)", thisEl->name, ptToInt(thisEl->val));
- thisEl = thisEl->next;
- }
- dyStringPrintf(dyMessage, "
\n");
- }
- }
+ struct cart *tmpCart = cartNew(NULL,NULL,NULL,NULL);
+ struct sqlConnection *conn2 = hConnectCentral();
+ cartLoadUserSession(conn2, userName, sessionName, tmpCart, NULL, NULL);
+ hDisconnectCentral(&conn2);
+ cartCheckForCustomTracks(tmpCart, dyMessage);
+
if (gotSettings)
{
description = replaceChars(description, "\\\\", "\\__ESC__");
description = replaceChars(description, "\\r", "\r");
description = replaceChars(description, "\\n", "\n");
description = replaceChars(description, "\\__ESC__", "\\");
dyStringPrintf(dyMessage,
"Description:
\n"
"
\n",
hgsNewSessionDescription, 5, 80,
highlightAccChanges, highlightAccChanges, description);
}
dyStringAppend(dyMessage, "\n");
sqlFreeResult(&sr);