-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework the concept of branch into a goal (#1742)
* stuff * progress * migration file * casing * cleanup * link to things * progress - ability to catalog a publication goal * copy game goal id when publishing * ability to catalog submission goals * require goal to publish a submission * add goal to API for pubs/subs * display goal on submission view page, fallback to submitted branch if goal has not yet been assigned * use goal instead of branch for publication history * use goal on TabularMovieList * when publishing, do not copy over sub branch to pub branch * progress on game page, currently shows the goal twice if it is a non-baseline goal * fix a thing * Game page - sort by goal * remove ability to edit branch on Publications/Edit * when updating a goal name, update pub/sub titles * Try not having a goal table, still needs the migration updated * remove migration * revert snapshot * update migration * update migration script * remove dead link to goals page
- Loading branch information
Showing
44 changed files
with
4,309 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
-- Does the initial migration of branches into game goals | ||
DO $$ | ||
DECLARE | ||
sub record; | ||
pub record; | ||
tempBranch citext; | ||
tempGameGoal record; | ||
tempGoalId integer; | ||
BEGIN | ||
|
||
RAISE NOTICE '--------------------------'; | ||
RAISE NOTICE '---- Submission Goals ----'; | ||
RAISE NOTICE '--------------------------'; | ||
DROP TABLE IF EXISTS _submissions; | ||
CREATE TEMPORARY TABLE _submissions (id int primary key, game_id int, branch citext); | ||
INSERT INTO _submissions | ||
SELECT id, game_id, TRIM(REPLACE(branch, '"', '')) AS branch | ||
FROM submissions | ||
WHERE game_goal_id IS NULL | ||
AND game_id IS NOT NULL | ||
ORDER BY id; | ||
|
||
FOR sub in SELECT id, game_id, branch FROM _submissions LOOP | ||
--RAISE NOTICE '-- Submission % --', sub.id; | ||
tempBranch = sub.branch; | ||
|
||
-- Handle Goal Record | ||
IF sub.branch IS NULL THEN | ||
tempBranch = 'baseline'; | ||
END IF; | ||
|
||
SELECT game_id, id INTO tempGameGoal FROM game_goals WHERE game_id = sub.game_id AND display_name = tempBranch; | ||
IF tempGameGoal IS NULL THEN | ||
--RAISE NOTICE 'GameGoal does not already exist, INSERTING'; | ||
INSERT INTO game_goals (game_id, display_name) VALUES (sub.game_id, tempBranch); | ||
SELECT game_id, display_name, id INTO tempGameGoal FROM game_goals WHERE game_id = sub.game_id AND display_name = tempBranch; | ||
IF tempGameGoal IS NULL THEN | ||
RAISE EXCEPTION 'FAILED TO INSERT GAME GOAL FOR %', sub.branch; | ||
END IF; | ||
END IF; | ||
|
||
UPDATE submissions SET game_goal_id = tempGameGoal.id WHERE id = sub.id; | ||
END LOOP; | ||
|
||
RAISE NOTICE '--------------------------'; | ||
RAISE NOTICE '---- Publication Goals ----'; | ||
RAISE NOTICE '--------------------------'; | ||
DROP TABLE IF EXISTS _publications; | ||
CREATE TEMPORARY TABLE _publications (id int primary key, game_id int, branch citext); | ||
INSERT INTO _publications | ||
SELECT id, game_id, TRIM(REPLACE(branch, '"', '')) AS branch | ||
FROM publications | ||
WHERE game_goal_id IS NULL | ||
AND game_id IS NOT NULL | ||
ORDER BY id; | ||
|
||
FOR pub in SELECT id, game_id, branch FROM _publications LOOP | ||
--RAISE NOTICE '-- Submission % --', sub.id; | ||
tempBranch = pub.branch; | ||
|
||
-- Handle Goal Record | ||
IF pub.branch IS NULL THEN | ||
tempBranch = 'baseline'; | ||
END IF; | ||
|
||
SELECT game_id, id INTO tempGameGoal FROM game_goals WHERE game_id = pub.game_id AND display_name = tempBranch; | ||
IF tempGameGoal IS NULL THEN | ||
--RAISE NOTICE 'GameGoal does not already exist, INSERTING'; | ||
INSERT INTO game_goals (game_id, display_name) VALUES (pub.game_id, tempBranch); | ||
SELECT game_id, display_name, id INTO tempGameGoal FROM game_goals WHERE game_id = pub.game_id AND display_name = tempBranch; | ||
IF tempGameGoal IS NULL THEN | ||
RAISE EXCEPTION 'FAILED TO INSERT GAME GOAL FOR %', pub.branch; | ||
END IF; | ||
END IF; | ||
|
||
UPDATE publications SET game_goal_id = tempGameGoal.id WHERE id = pub.id; | ||
END LOOP; | ||
END $$ | ||
|
||
--SELECT * FROM game_goals | ||
--UPDATE submissions SET game_goal_id = NULL | ||
--UPDATE publications SET game_goal_id = NULL | ||
--DELETE FROM game_goals | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace TASVideos.Data.Entity.Game; | ||
|
||
public class GameGoal | ||
{ | ||
public int Id { get; set; } | ||
public int GameId { get; set; } | ||
public virtual Game? Game { get; set; } | ||
|
||
[Required] | ||
[StringLength(50)] | ||
public string DisplayName { get; set; } = ""; | ||
|
||
public virtual ICollection<Publication> Publications { get; set; } = new HashSet<Publication>(); | ||
public virtual ICollection<Submission> Submissions { get; set; } = new HashSet<Submission>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.