diff --git a/unwind-ui/src/App.vue b/unwind-ui/src/App.vue index 6ee6c5f..f611e39 100644 --- a/unwind-ui/src/App.vue +++ b/unwind-ui/src/App.vue @@ -25,9 +25,7 @@

- Search + Search
diff --git a/unwind-ui/src/components/MovieList.vue b/unwind-ui/src/components/MovieList.vue index 35f371d..d84efe6 100644 --- a/unwind-ui/src/components/MovieList.vue +++ b/unwind-ui/src/components/MovieList.vue @@ -29,8 +29,18 @@ {{ item.media_type }} - {{ imdb_rating(item.imdb_score) }} - {{ avg_imdb_rating(item.user_scores) }} + {{ imdb_rating(item.imdb_score) }} + {{ avg_imdb_rating(item.user_scores) }} {{ duration(item.runtime) }} @@ -46,7 +56,6 @@ import { defineComponent } from "vue" import { mean, pstdev } from "../utils.ts" - function avg_imdb_rating(scores) { return imdb_rating(scores.length === 0 ? null : mean(scores)) } @@ -125,6 +134,5 @@ export default defineComponent({ background-color: rgb(245, 197, 24); } .user-score { - } diff --git a/unwind-ui/src/components/UserLogin.vue b/unwind-ui/src/components/UserLogin.vue index e20aedd..d897a3f 100644 --- a/unwind-ui/src/components/UserLogin.vue +++ b/unwind-ui/src/components/UserLogin.vue @@ -25,11 +25,7 @@

-

diff --git a/unwind-ui/src/utils.ts b/unwind-ui/src/utils.ts index 382af53..15aa8d4 100644 --- a/unwind-ui/src/utils.ts +++ b/unwind-ui/src/utils.ts @@ -10,7 +10,7 @@ export function mean(nums) { return sum(nums) / nums.length } -export function pstdev(nums, mu=null) { +export function pstdev(nums, mu = null) { if (mu === null) { mu = mean(nums) } diff --git a/unwind/db.py b/unwind/db.py index 1381e52..21e9728 100644 --- a/unwind/db.py +++ b/unwind/db.py @@ -566,11 +566,11 @@ async def find_movies( query = f""" SELECT {','.join(sql_fields(Movie))} FROM {Movie._table} - WHERE {(' AND '.join(conditions)) if conditions else '1=1'} - ORDER BY - length({Movie._table}.title) ASC, - {Movie._table}.imdb_score DESC, - {Movie._table}.release_year DESC + WHERE {(' AND '.join(conditions)) if conditions else '1=1'} + ORDER BY + length({Movie._table}.title) ASC, + {Movie._table}.imdb_score DESC, + {Movie._table}.release_year DESC LIMIT :skip_rows, :limit_rows """ rows = await shared_connection().fetch_all(bindparams(query, values)) diff --git a/unwind/web.py b/unwind/web.py index 550b266..f043f18 100644 --- a/unwind/web.py +++ b/unwind/web.py @@ -319,9 +319,6 @@ async def add_movie(request): not_implemented() -import_lock = asyncio.Lock() - - @route("/movies/_reload_imdb", methods=["GET"]) @requires(["authenticated", "admin"]) async def progress_for_load_imdb_movies(request): @@ -352,11 +349,14 @@ async def progress_for_load_imdb_movies(request): return JSONResponse(resp) +_import_lock = asyncio.Lock() + + @route("/movies/_reload_imdb", methods=["POST"]) @requires(["authenticated", "admin"]) async def load_imdb_movies(request): - async with import_lock: + async with _import_lock: progress = await db.get_import_progress() if progress and not progress.stopped: return JSONResponse(