This commit is contained in:
ducklet 2021-08-04 17:30:17 +02:00
parent ff4f8fa246
commit fb059ae5d1
6 changed files with 24 additions and 22 deletions

View file

@ -25,9 +25,7 @@
</span>
</p>
<div class="control">
<a class="button is-info"
:disabled="!active"
> Search </a>
<a class="button is-info" :disabled="!active"> Search </a>
</div>
</div>

View file

@ -29,8 +29,18 @@
<span class="mediatype">{{ item.media_type }}</span>
</td>
<td>
<span class="score imdb-score tag is-large" :title="`IMDb rating (1-10) / ${item.imdb_votes} votes`">{{ imdb_rating(item.imdb_score) }}</span>
<span class="score tag is-info is-large" :title="`User rating (1-10) / ${item.user_scores.length} votes / σ = ${imdb_stdev(item.user_scores)}`">{{ avg_imdb_rating(item.user_scores) }}</span>
<span
class="score imdb-score tag is-large"
:title="`IMDb rating (1-10) / ${item.imdb_votes} votes`"
>{{ imdb_rating(item.imdb_score) }}</span
>
<span
class="score tag is-info is-large"
:title="`User rating (1-10) / ${
item.user_scores.length
} votes / σ = ${imdb_stdev(item.user_scores)}`"
>{{ avg_imdb_rating(item.user_scores) }}</span
>
</td>
<td>
<span>{{ duration(item.runtime) }}</span>
@ -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 {
}
</style>

View file

@ -25,11 +25,7 @@
</span>
</p>
<p class="control">
<button
class="button is-primary is-small"
:disabled="!active"
@click="login"
>
<button class="button is-primary is-small" :disabled="!active" @click="login">
Login
</button>
</p>

View file

@ -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)
}

View file

@ -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(