Skip to content

Commit

Permalink
Added requested changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Boddin committed Sep 11, 2023
1 parent b4ce2df commit 8d8aefa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Server/src/routes/poi.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ export class PoiRoute {
properties: null
}

const track = (await database.tracks.getById(userData.trackId)) ?? undefined
if (track == undefined) {
const track: Track | null = await database.tracks.getById(userData.trackId)
if (track == null) {
logger.error(`Could not find track with id ${userData.trackId} to update POI with id ${userData.id}.`)
res.sendStatus(404)
return
Expand Down
2 changes: 1 addition & 1 deletion Server/src/routes/track.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class TrackRoute {
: undefined
// Also acquire the percentage position. It might happen that a percentage position is known, while the position is not.
// This might not make much sense.
const percentagePosition: number | undefined = trackKm !== null && trackKm !== undefined
const percentagePosition: number | undefined = trackKm != null
? (await TrackService.getTrackKmAsPercentage(trackKm, track)) ?? undefined
: undefined
const heading: number = await VehicleService.getVehicleHeading(vehicle)
Expand Down
2 changes: 1 addition & 1 deletion Server/src/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class UserService {
*/
public static async updateUsername(username: string, usernameChangeRequest: UsernameChangeRequest): Promise<boolean> {
// Check if input was valid
if (username !== usernameChangeRequest.oldUsername || usernameChangeRequest.newUsername !== "") {
if (username !== usernameChangeRequest.oldUsername || usernameChangeRequest.newUsername === "") {
return false
}

Expand Down

0 comments on commit 8d8aefa

Please sign in to comment.