You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
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');
162
+
// Set count of Watched Categories for users
163
+
Gdn::sql()->query('update GDN_User u, (select wc.UserID, count(wc.CategoryID) count from GDN_Category c
164
+
join (select distinct um.UserID, SUBSTRING_INDEX(um.Name, ".", -1) as CategoryID from GDN_UserMeta um where um.Name LIKE "Preferences.%" and Value = 1) wc
165
+
where wc.CategoryID = c.CategoryID group by wc.UserID) uc
166
+
set u.CountWatchedCategories = uc.count
167
+
where u.UserID = uc.UserID', 'update');
166
168
169
+
Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = 0 where u.CountWatchedCategories is null', 'update');
// 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');
0 commit comments