Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit eada4bd

Browse files
committed
fix gamearchive collection name, fix delete release bug
1 parent e8d0763 commit eada4bd

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

app/routes/releases/release.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ router.delete('/:commit_id', function(req, res)
6363
return handleError(err);
6464
}
6565
req.flash('success', 'Deleted release');
66-
let release = await Release.getByCommitId(req.body.commitId);
67-
let game = await Game.getById(release.game);
66+
let game = await Game.getBySlug(req.body.game);
6867
let baseUrl = '';
6968
if (!game.isArchived){
7069
baseUrl = '/games';

app/views/games/release.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ append gameContent
4242
.col-sm-9.col-sm-offset-3.text-center
4343
input(type="hidden" name="updatedBy" value=user._id)
4444
input(type="hidden" name="release" value=release._id)
45+
input(type="hidden" name="game" value=game.slug)
4546
button.btn.btn-lg.btn-primary(type="submit" name="action" value="PATCH") Update
4647
|
4748
button.btn.btn-lg.btn-danger(data-toggle="confirm" type="submit" name="action" value="DELETE") Delete

scripts/updateArchived.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ mongoose.connect(process.env.MONGO_DATABASE, function()
1717
{multi: true}
1818
);
1919
console.log('Active games have been updated.');
20-
mongoose.connection.db.collection('game-archive').find({}).forEach(game => {
20+
mongoose.connection.db.collection('gamearchives').find({}).forEach(game => {
2121
game.isArchived = true;
2222
mongoose.connection.db.collection('games').insert(game);
2323
});
2424
console.log('Archived games transferred.');
25+
return;
2526
});

0 commit comments

Comments
 (0)