Skip to content

Merging Completed Profile - #240

Open
morganthegirlboss wants to merge 35 commits into
devfrom
morgan-profile-integration
Open

Merging Completed Profile#240
morganthegirlboss wants to merge 35 commits into
devfrom
morgan-profile-integration

Conversation

@morganthegirlboss

Copy link
Copy Markdown
Contributor

Finally got the Profile to display user rank, as well as user league

morganthegirlboss and others added 30 commits July 30, 2026 18:48
…this as i am confused about which id is retrieved from user.id
…ct elo for other people but i have a backend failure
… profile view value so that user values can fit in profile and user provider values for providing league

@Swe-yy Swe-yy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the comments



async getUserRank(userId: string): Promise<RankDTO | null>{
return this.eloRepository.getUserRank(userId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is supposed to be in a controller not in a system

const user_repo = new UserRepository(AppDataSource.getRepository(Users))
const elo_repo = new EloRepository(AppDataSource.getRepository(EloRatings))

const leaderboard_system = new LeaderboardSystem(elo_repo);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pass the elo_repo to the controller
there's no need for the systems to be involved here

return;
}

const rank = await service.getUserRank(userId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just call the repo directly for simple getters

Use the service (not system) when responses need multiple repo calls and added processing

}
}

async getUserRank(userId: string): Promise<RankDTO | null> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in the user repo because rank is in attribute of a user not of elo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this was in elo repository is because even though it is getting the user's rank, it requires elo calculations in order to get the rank and so if you look in the getUserRank function in the elo repository, the elo repository needs to be fetched so that those different operations in order to fetch and order elo can be done. I do understand it is confusing and a bit counter intuitive though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. The elo is already calculated. What calculations are needed.
The elo repository can still be called by the leaderboard Service if it's needed

setError(`Error: ${res.status} ${res.data}`);
}
})
// await axios.get(url.concat('user/league'), {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these comments if they arent being used

// }
// })

if(elo >= 600 && elo < 1200){ //change this to "elo >= 600", the lowest is 600, but test_user has an elo of 0 so that needs to be changed then this should be changed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be converted to a map or switch statement
Please look into converting this


try {
await axios.get(url.concat('user/rank'), {
await axios.get(url.concat('elo/rank'), {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is rank an attribute of elo


const Leaderboard = () => {
const { userData, topThree, isLoadingData, error, page, totalPages, nextPage, prevPage } = LeaderboardViewModel('earth');
const { userData, topThree, isLoadingData, error, page, totalPages, setPage, nextPage, prevPage } = LeaderboardViewModel('earth');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is setPage for

if the page needs to be changes use navigation instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not create that variable and upon further inspection it seems this is Ntu's work and setPage specifically changes which users are shown on the leaderboard (different pages of users of differing rank), so i do believe this should be kept

Comment thread frontend/src/App.tsx Outdated
<Route path='/dashboard' element={<Dashboard/>}/>
<Route path='/profile' element={<Profile/>}/>
<Route path='/leaderboard' element={<Leaderboard/>}/>
<Route path='fr' element={<FinalResults/>}/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this path to be more intuitive

Comment thread package.json Outdated
"axios": "^1.18.1",
"clsx": "^2.1.1",
"color-convert": "^3.1.3",
"jest": "^30.4.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls delete jest

@sonarqubecloud

Copy link
Copy Markdown

@nsmzoneli nsmzoneli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Pull from dev and conflict resolve before you make any changes.

Please remove "League -" Before the user's league in the profile, it becomes a bit redundant when it's made clear to the user that "Mercury" means their league from the dashboard. I'm going to assume the actual fetching of elo values works on your machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants