From 5831d974ece137d520a43f7f8862eda27711c03c Mon Sep 17 00:00:00 2001
From: Joe Ardent
+ Hello, {{ usr.username }}! It's nice to see you.
+
-Hello, {{ usr.username }}! It's nice to see you.
+
Date: Sun, 22 Oct 2023 13:35:41 -0700
Subject: [PATCH] random styling and shit
---
src/bin/import_omega.rs | 36 ++++++++-------------------------
src/import_utils.rs | 10 ++++-----
templates/css/ww.css | 25 +++++++++++++++++++++--
templates/header_with_user.html | 18 ++++++++---------
templates/my_watches_page.html | 29 +++++++++++++++-----------
5 files changed, 62 insertions(+), 56 deletions(-)
diff --git a/src/bin/import_omega.rs b/src/bin/import_omega.rs
index a151395..02925bc 100644
--- a/src/bin/import_omega.rs
+++ b/src/bin/import_omega.rs
@@ -1,10 +1,7 @@
use std::{ffi::OsString, time::Duration};
use clap::Parser;
-use sqlx::{
- query_as,
- sqlite::{SqliteConnectOptions, SqlitePoolOptions},
-};
+use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions};
use what2watch::{get_db_pool, import_utils::add_omega_watches};
#[derive(Debug, Parser)]
@@ -42,7 +39,7 @@ fn main() {
let w2w_db = get_db_pool();
- let dur = {
+ let (dur, rows) = {
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
@@ -50,33 +47,16 @@ fn main() {
rt.block_on(async {
let dur = add_omega_watches(&w2w_db, &movie_db, num).await.unwrap();
+ let rows: i32 = sqlx::query_scalar("select count(*) from watches")
+ .fetch_one(&w2w_db)
+ .await
+ .unwrap();
+
w2w_db.close().await;
- dur
+ (dur, rows)
})
};
- let w2w_db = get_db_pool();
- let movies: Vec<(String, f64, i64)> = {
- let rt = tokio::runtime::Builder::new_multi_thread()
- .enable_all()
- .build()
- .unwrap();
- let movies = rt.block_on(
- query_as(
- "select julid_string(id), julid_seconds(id) * 1000, julid_counter(id) from watches",
- )
- .fetch_all(&w2w_db),
- )
- .unwrap();
- rt.block_on(w2w_db.close());
- movies
- };
- let rows = movies.len();
-
- for m in movies.iter() {
- println!("{}: {}ms, {} count", m.0, m.1, m.2);
- }
-
println!(
"Added {rows} movies in {} seconds ({}ms, {}us)",
dur.as_secs_f64(),
diff --git a/src/import_utils.rs b/src/import_utils.rs
index 23fe3b8..0121c79 100644
--- a/src/import_utils.rs
+++ b/src/import_utils.rs
@@ -7,7 +7,7 @@ use crate::{util::year_to_epoch, ShowKind, User, Watch, WatchQuest};
const USER_EXISTS_QUERY: &str = "select count(*) from users where id = $1";
-const MOVIE_QUERY: &str = "select * from movies order by random() limit ?";
+const MOVIE_QUERY: &str = "select * from movie_titles order by year, title asc limit ?";
//-************************************************************************
// the omega user is the system ID, but has no actual power in the app
@@ -19,7 +19,7 @@ const BULK_INSERT: usize = 2_000;
pub struct ImportMovieOmega {
pub title: String,
pub year: Option
+
{% else %}
{% endif %}
-
-
diff --git a/templates/my_watches_page.html b/templates/my_watches_page.html
index af0df05..0ed8428 100644
--- a/templates/my_watches_page.html
+++ b/templates/my_watches_page.html
@@ -8,29 +8,34 @@
Whatcha Watchin?
{% match user %}
- {% when Some with (usr) %}
+{% when Some with (usr) %}
+
Here are your things to watch:
-
- {% else %}- Heya, why don't you log in or sign up? + Heya, why don't you log in or sign up?
{% endmatch %}