Skip to content

Commit

Permalink
adds totalScore and adminComments field
Browse files Browse the repository at this point in the history
  • Loading branch information
aanxniee committed Nov 29, 2023
1 parent 475bb29 commit 724056e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ const SEEDED_DATA = [
applicationId: 1,
reviewerId: 1,
reviewerEmail: userEmails[0],
passionFSG: 0,
teamPlayer: 0,
desireToLearn: 0,
skill: 0,
passionFSG: 2,
teamPlayer: 3,
desireToLearn: 2,
skill: 4,
totalScore: 11,
reviewerComments: "Great job presenting your case study!",
adminComments: "Good!",
recommendedSecondChoice: "N/A",
skillCategory: "junior",
},
{
applicationId: 1,
reviewerId: 2,
reviewerEmail: userEmails[1],
passionFSG: 0,
teamPlayer: 0,
desireToLearn: 0,
skill: 0,
passionFSG: 5,
teamPlayer: 4,
desireToLearn: 4,
skill: 5,
totalScore: 18,
reviewerComments: "Very good!",
adminComments: "Awesome job!",
recommendedSecondChoice: "considered",
skillCategory: "intermediate",
},
Expand Down Expand Up @@ -78,6 +82,10 @@ export const up: Migration = async ({ context: sequelize }) => {
type: DataType.INTEGER,
allowNull: false,
},
totalScore: {
type: DataType.INTEGER,
allowNull: false,
},
skillCategory: {
type: DataType.ENUM("junior", "intermediate", "senior"),
allowNull: false,
Expand All @@ -86,6 +94,10 @@ export const up: Migration = async ({ context: sequelize }) => {
type: DataType.STRING,
allowNull: false,
},
adminComments: {
type: DataType.STRING,
allowNull: false,
},
recommendedSecondChoice: {
type: DataType.ENUM("N/A", "considered", "not considered"),
allowNull: false,
Expand Down
16 changes: 16 additions & 0 deletions backend/typescript/models/applicationDashboard.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ForeignKey,
Model,
Table,
BeforeSave,
} from "sequelize-typescript";
import Application from "./application.model";
import User from "./user.model";
Expand Down Expand Up @@ -58,4 +59,19 @@ export default class ApplicationDashboardTable extends Model {

@BelongsTo(() => Application)
application!: Application;

@Column({ type: DataType.STRING })
adminComments!: string;

@Column({ type: DataType.INTEGER })
totalScore!: number;

@BeforeSave
static calculateTotalScore(instance: ApplicationDashboardTable) {
instance.totalScore =
instance.passionFSG +
instance.desireToLearn +
instance.skill +
instance.teamPlayer;
}
}

0 comments on commit 724056e

Please sign in to comment.