Skip to content

Commit

Permalink
🚑 divide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
SkulderLock committed Jul 31, 2023
1 parent 15bedfe commit c1cd5db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ public int getUserBMI() {
}

public void setUserBMI(int userHeight, int userWeight) {
this.userBMI = userHeight/userWeight;
if (userWeight == 0) {
this.userBMI = 0;
} else {
this.userBMI = userHeight/userWeight;
}
}

public void setUserBMI(int userBMI) {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/pages/profile/profile.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { ProfilePage } from './profile.page';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AuthenticationService } from '../../services/services';
import { UserI } from '../../models/interfaces';


describe('ProfilePage', () => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/pages/profile/profile.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export class ProfilePage implements OnInit {


private updateSettingsOnServer() {
// console.log(this.userpreferences);
this.settingsApiService.updateSettings(this.userpreferences).subscribe(
(response) => {
if (response.status === 200) {
Expand Down

0 comments on commit c1cd5db

Please sign in to comment.