Skip to content

Commit

Permalink
Kode for feilhåndtering zerodvivisionerror i metode for formatering tid
Browse files Browse the repository at this point in the history
  • Loading branch information
xivind committed Mar 11, 2024
1 parent f354346 commit 99e66f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion presentator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ def get_current_week_number():


def format_duration(duration_minutes):
hours = int((duration_minutes/60)/60)
try:
hours = int((duration_minutes/60)/60)

except (ZeroDivisionError) as error:
hours = 0
print(f'An error occured formating time: {error}')

return hours


Expand Down
2 changes: 2 additions & 0 deletions web/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.page-wrapper {
display: flex;
flex-direction: column;
padding-left: 10px;
padding-right: 20px;
}

/* Style for the html body */
Expand Down

0 comments on commit 99e66f3

Please sign in to comment.