Skip to content

Commit

Permalink
Change video rating value
Browse files Browse the repository at this point in the history
  • Loading branch information
olilag committed Aug 7, 2024
1 parent 3dbe2bb commit 3f36414
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pages/videos/all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function allVideos() {
Hodnotenie:{' '}
{video.users.length == 0
? 'Žiadne hodnotenie'
: `${video.rating} / ${video.users.length * 10}`}
: `${video.rating}`}
</div>
<div className="mx-5 my-1.5">
Autor: {video.CreatedBy.team.name} ({video.CreatedBy.name})
Expand Down
2 changes: 1 addition & 1 deletion pages/videos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function myVideos(user: User) {
Hodnotenie:{' '}
{video.users.length == 0
? 'Žiadne hodnotenie'
: `${video.rating} / ${video.users.length * 10}`}
: `${video.rating}`}
</div>
</div>
))
Expand Down
6 changes: 3 additions & 3 deletions pages/videos/watch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ async function watchVideos(user: User) {
Zadaj hodnotenie (1-10):
<input
type="number"
defaultValue={0}
defaultValue={1}
id="rating"
name="rating"
min={0}
min={1}
max={10}
required
/>
Expand Down Expand Up @@ -92,7 +92,7 @@ export async function post(req: SessionRequest): Promise<Response> {
await db.video.update({
where: { id: videoId },
data: {
rating: { increment: rating },
rating: { increment: rating * rating * rating },
users: {
connect: {
id: ratedByUser.id
Expand Down

0 comments on commit 3f36414

Please sign in to comment.