Skip to content

Commit

Permalink
Removed useless setters #69
Browse files Browse the repository at this point in the history
  • Loading branch information
niqore committed Aug 8, 2020
1 parent d690939 commit edc2b18
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/commands/admin/ChangePointsCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ChangePointsCommand = async function(language, message, args) {
let entity;
const playerId = message.mentions.users.last().id;
[entity] = await Entities.getOrRegister(playerId);
await entity.Player.setPoints(args[1]);
entity.Player.score = parseInt(args[1]);
await entity.Player.save();

embed.setColor(JsonReader.bot.embed.default)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin/ChangePointsWeekCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ChangePointsWeekCommand = async function(language, message, args) {
let entity;
const playerId = message.mentions.users.last().id;
[entity] = await Entities.getOrRegister(playerId);
await entity.Player.setPointsWeek(args[1]);
entity.Player.weeklyScore = parseInt(args[1]);
await entity.Player.save();

embed.setColor(JsonReader.bot.embed.default)
Expand Down
16 changes: 0 additions & 16 deletions src/core/models/Players.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,6 @@ module.exports = (Sequelize, DataTypes) => {
.includes(badge);
};

/**
* @param {("points")} points - A number representating the score
* @deprecated 2.1.0 Directly use score attribute from entity
*/
Players.prototype.setPoints = function(points) {
this.score = points;
};

/**
* @param {("pointsWeek")} pointsWeek - A number representating the weekly score
* @deprecated 2.1.0 Directly use weeklyScore attribute from entity
*/
Players.prototype.setPointsWeek = function(points) {
this.weeklyScore = points;
};

Players.beforeSave((instance, options) => {
instance.setDataValue('updatedAt',
require('moment')().format('YYYY-MM-DD HH:mm:ss'));
Expand Down

0 comments on commit edc2b18

Please sign in to comment.