Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INTF23 ReviewDashboardChanges #47

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions backend/typescript/graphql/resolvers/dashboardResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
_parent: undefined,
{ secondChoice }: { secondChoice: ApplicantRole },
): Promise<Array<ApplicationDTO>> => {
const applications = await dashboardService.getApplicationsBySecondChoiceRole(
secondChoice,
);
const applications =

Check failure on line 42 in backend/typescript/graphql/resolvers/dashboardResolvers.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎········await·dashboardService.getApplicationsBySecondChoiceRole(secondChoice` with `·await·dashboardService.getApplicationsBySecondChoiceRole(⏎········secondChoice,⏎······`
await dashboardService.getApplicationsBySecondChoiceRole(secondChoice);
return applications;
},
dashboardsByApplicationId: async (
Expand Down Expand Up @@ -79,8 +78,10 @@
teamPlayer,
desireToLearn,
skill,
totalScore,
skillCategory,
reviwerComments,
adminComments,
recommendedSecondChoice,
}: {
reviewerEmail: string;
Expand All @@ -90,8 +91,10 @@
teamPlayer: number;
desireToLearn: number;
skill: number;
totalScore: number;
skillCategory: string;
reviwerComments: string;
adminComments: string;
recommendedSecondChoice: string;
},
): Promise<ApplicationDashboardDTO> => {
Expand All @@ -103,8 +106,10 @@
teamPlayer,
desireToLearn,
skill,
totalScore,
skillCategory,
reviwerComments,
adminComments,
recommendedSecondChoice,
);
},
Expand Down
2 changes: 2 additions & 0 deletions backend/typescript/graphql/types/dashboardType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ const dashboardType = gql`
teamPlayer: Int!
desireToLearn: Int!
skill: Int!
totalScore: Int!
skillCategory: String!
reviwerComments: String!
adminComments: String!
recommendedSecondChoice: String!
): ApplicationDashboardDTO!
}
Expand Down
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 @@
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 @@

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

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

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

@BeforeSave

Check warning on line 69 in backend/typescript/models/applicationDashboard.model.ts

View workflow job for this annotation

GitHub Actions / run-lint

Missing return type on function
static calculateTotalScore(instance: ApplicationDashboardTable) {
instance.totalScore =

Check failure on line 71 in backend/typescript/models/applicationDashboard.model.ts

View workflow job for this annotation

GitHub Actions / run-lint

Assignment to property of function parameter 'instance'
instance.passionFSG +
instance.desireToLearn +
instance.skill +
instance.teamPlayer;
}
}
43 changes: 27 additions & 16 deletions backend/typescript/services/implementations/appDashboardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down Expand Up @@ -166,8 +168,8 @@
);
},
);
applicationsBySecondChoiceRoleDTO = await applicationsBySecondChoiceRole.map(
(application) => {
applicationsBySecondChoiceRoleDTO =

Check failure on line 171 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎········await·applicationsBySecondChoiceRole.map(` with `·await·applicationsBySecondChoiceRole.map(⏎········`
await applicationsBySecondChoiceRole.map((application) => {
return {
id: application.id,
academicOrCoop: application.academicOrCoop,
Expand All @@ -191,8 +193,7 @@
timesApplied: application.timesApplied,
timestamp: application.timestamp,
};
},
);
});

Check failure on line 196 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `,⏎······`
} catch (error: unknown) {
Logger.error(
`Failed to get applications by this second choice role = ${role}. Reason = ${getErrorMessage(
Expand Down Expand Up @@ -221,8 +222,10 @@
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand All @@ -243,15 +246,13 @@
role: ApplicantRole,
): Promise<ApplicationDashboardRowDTO[]> {
// get all the applications for the role
const applications: Array<ApplicationDTO> = await this.getApplicationsByRole(
role,
);
const applications: Array<ApplicationDTO> =

Check failure on line 249 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎······await·this.getApplicationsByRole(role` with `·await·this.getApplicationsByRole(⏎······role,⏎····`
await this.getApplicationsByRole(role);
// get the dashboards associated with the applications
const appDashRows: Array<ApplicationDashboardRowDTO> = await Promise.all(
applications.map(async (application) => {
const reviewDashboards: Array<ApplicationDashboardDTO> = await this.getDashboardsByApplicationId(
application.id,
);
const reviewDashboards: Array<ApplicationDashboardDTO> =

Check failure on line 254 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎··········await·this.getDashboardsByApplicationId(application.id` with `·await·this.getDashboardsByApplicationId(⏎··········application.id,⏎········`
await this.getDashboardsByApplicationId(application.id);
const reviewers: Array<UserDTO> = await Promise.all(
reviewDashboards.map(async (dash) => {
return userService.getUserByEmail(dash.reviewerEmail);
Expand All @@ -271,15 +272,13 @@
role: ApplicantRole,
): Promise<ApplicationDashboardRowDTO[]> {
// get all the applications for the role
const applications: Array<ApplicationDTO> = await this.getApplicationsBySecondChoiceRole(
role,
);
const applications: Array<ApplicationDTO> =

Check failure on line 275 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎······await·this.getApplicationsBySecondChoiceRole(role` with `·await·this.getApplicationsBySecondChoiceRole(⏎······role,⏎····`
await this.getApplicationsBySecondChoiceRole(role);
// get the dashboards associated with the applications
const appDashRows: Array<ApplicationDashboardRowDTO> = await Promise.all(
applications.map(async (application) => {
const reviewDashboards: Array<ApplicationDashboardDTO> = await this.getDashboardsByApplicationId(
application.id,
);
const reviewDashboards: Array<ApplicationDashboardDTO> =

Check failure on line 280 in backend/typescript/services/implementations/appDashboardService.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `⏎··········await·this.getDashboardsByApplicationId(application.id` with `·await·this.getDashboardsByApplicationId(⏎··········application.id,⏎········`
await this.getDashboardsByApplicationId(application.id);
const reviewers: Array<UserDTO> = await Promise.all(
reviewDashboards.map(async (dash) => {
return userService.getUserByEmail(dash.reviewerEmail);
Expand Down Expand Up @@ -331,8 +330,10 @@
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand All @@ -347,8 +348,10 @@
teamPlayer: number,
desireToLearn: number,
skill: number,
totalScore: number,
skillCategory: string,
reviewerComments: string,
adminComments: string,
recommendedSecondChoice: string,
): Promise<ApplicationDashboardDTO> {
try {
Expand All @@ -363,8 +366,10 @@
teamPlayer,
desireToLearn,
skill,
totalScore,
skillCategory,
reviewerComments,
adminComments,
recommendedSecondChoice,
});
Logger.error(`the data: ${JSON.stringify(dashboard)}`);
Expand All @@ -375,8 +380,10 @@
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down Expand Up @@ -413,8 +420,10 @@
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down Expand Up @@ -447,8 +456,10 @@
teamPlayer: dashboard.teamPlayer,
desireToLearn: dashboard.desireToLearn,
skill: dashboard.skill,
totalScore: dashboard.totalScore,
skillCategory: dashboard.skillCategory,
reviewerComments: dashboard.reviewerComments,
adminComments: dashboard.adminComments,
recommendedSecondChoice: dashboard.recommendedSecondChoice,
reviewerId: dashboard.reviewerId,
applicationId: dashboard.applicationId,
Expand Down
11 changes: 8 additions & 3 deletions backend/typescript/services/interfaces/appDashboardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ interface IAppDashboardService {
* @Param reviewerEmail the email of the reviewer
* @param applicationId the id of the application (seperate from the postgres id field of the application)
* @param reviewerAuthId the Firebase auth id of the user (This is NOT the same as the postgress id field of the user)
* @param passionFSG passion for social good rating of applicatn
* @param teamPlayer teamwork rating of applicatn
* @param skill skill rating of applicatn
* @param passionFSG passion for social good rating of application
* @param teamPlayer teamwork rating of application
* @param desireToLearn willingness to learn rating of application
* @param skill skill rating of application
* @param totalScore sum of passionFSG, teamPlayer, desireToLearn, and skill
* @param skillCategory whether applicant is viewed as junior, intermediate, or senior
* @param reviewerComments comments of the application from reviewer
* @param adminComments comments of the application from admin
* @param recommendedSecondChoice an indication of whether 2nd choice is recommended
* @param reviewComplete whether the reviewer has finished the review
* @returns an array of the updated dashboard entry ids
Expand All @@ -54,8 +57,10 @@ interface IAppDashboardService {
teamPlayer: number,
desireToLearn: number,
skill: number,
totalScore: number,
skillCategory: string,
reviewerComments: string,
adminComments: string,
recommendedSecondChoice: string,
): Promise<ApplicationDashboardDTO>;

Expand Down
2 changes: 2 additions & 0 deletions backend/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ export type ApplicationDashboardDTO = {
teamPlayer: number;
desireToLearn: number;
skill: number;
totalScore: number;
skillCategory: string;
reviewerComments: string;
adminComments: string;
recommendedSecondChoice: string;
reviewerId: number;
applicationId: number;
Expand Down
Loading