Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Change Script Details

Release23.19
Deployable(none)
Group
StatusActive
Modified6/12/2024 12:54:54 AM by cys-josh

Script Text

--AH:ScriptId=283b481d-907d-4ac6-86f6-4679d7bf6e72;79 USE ChooseYourStory IF OBJECT_ID('Homepage_GetHomepage') IS NOT NULL DROP PROCEDURE Homepage_GetHomepage GO CREATE PROCEDURE Homepage_GetHomepage ( @Username VARCHAR(20) ) AS BEGIN SELECT TOP 5 GP.* FROM [MyAdventureGame]..[Games - Published] GP JOIN [MyAdventureGame]..[Games] G ON GP.[Game Id] = G.[Game Id] ORDER BY (Select [MyAdventureGame].[dbo].[Game Ratings - Calculated].[Pop_Adjusted_Rating] from [MyAdventureGame].[dbo].[Game Ratings - Calculated] WHERE [MyAdventureGame].[dbo].[Game Ratings - Calculated].[Game ID] = GP.[Game Id]) DESC select top 10 * from [MyAdventureGame].[dbo].[Games] order by [MyAdventureGame].[dbo].[Games].[Date Published] desc SELECT TOP 5 GP.* FROM [MyAdventureGame]..[Games - Published] GP JOIN [MyAdventureGame]..[Games] G ON GP.[Game Id] = G.[Game Id] WHERE [Rating Count] < 50 AND NOT EXISTS(SELECT NULL FROM [MyAdventureGame].[dbo].[Game Ratings] WHERE [MyAdventureGame].[dbo].[Game Ratings].[Game ID] = G.[Game Id] AND [MyAdventureGame].[dbo].[Game Ratings].[Username] = COALESCE(@Username, '')) ORDER BY (CASE WHEN [Rating] >= 5 THEN 1 ELSE 0 END) DESC, [Rating Count] DESC, GP.[First Publish Date] DESC SELECT TOP 2 FP.* FROM [MyAdventureGame]..[Forums_Posts] FP JOIN [MyAdventureGame]..[Forums_Messages] FM ON FP.[Message_Id] = FM.[Message_Id] AND FP.[Left]=1 WHERE FM.[Forum_Id] = 2 ORDER BY [Post_Date] DESC END GO GRANT EXECUTE ON [Homepage_GetHomepage] TO CYS_UserRole