Skip to content

Commit b41f458

Browse files
committed
Revert "Issues-523: recalculated CountWatchedCategories"
This reverts commit 210ce05.
1 parent 43d1350 commit b41f458

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

config/vanilla/bootstrap.early.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,16 @@
159159
->column('CountWatchedCategories', 'int', null)
160160
->set(false, false);
161161

162-
// Set count of Watched Categories for users
162+
// Set count of WatchedCategories for users
163163
Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
164-
select count(c.CategoryID) from GDN_Category c, (select distinct SUBSTRING_INDEX(um.Name, ".", -1) as CategoryID from GDN_UserMeta um
165-
where um.Name LIKE "Preferences.%" AND um.UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID)', 'update');
164+
select count(c.CategoryID) from GDN_Category c, (select distinct CAST(SUBSTRING_INDEX(um.Name, ".", -1) as UNSIGNED) as CategoryID from GDN_UserMeta um
165+
where um.Name LIKE "Preferences.%" AND UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID)', 'update');
166+
166167
}
167168

168169
// FIX: https://github.com/topcoder-platform/forums/issues/479
169-
// Re-calculate count of Watched Categories if CountWatchedCategories is null
170-
// Remove it later. It should be executed only once when the column is added
171-
Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
172-
select count(c.CategoryID) from GDN_Category c, (select distinct SUBSTRING_INDEX(um.Name, ".", -1) as CategoryID from GDN_UserMeta um
173-
where um.Name LIKE "Preferences.%" AND um.UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID) where CountWatchedCategories is null', 'update');
174-
170+
// Re-calculate count of WatchedCategories if WatchedCategories is null
171+
// Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
172+
// select count(c.CategoryID) from GDN_Category c, (select distinct CAST(SUBSTRING_INDEX(um.Name, ".", -1) as UNSIGNED) as CategoryID from GDN_UserMeta um
173+
// where um.Name LIKE "Preferences.%" AND UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID) where CountWatchedCategories is null', 'update');
175174
}

0 commit comments

Comments
 (0)