renamed completed to times_completed

This commit is contained in:
FrenchGithubUser
2025-10-17 19:05:20 +02:00
parent dbcada55f6
commit 04ecb427be
14 changed files with 36 additions and 36 deletions

View File

@@ -86,7 +86,7 @@
// }
// if let Some(TorrentEvent::Completed) = ann.event {
// let _ = arc.pool.increment_torrent_completed(torrent.id).await;
// let _ = arc.pool.increment_torrent_times_completed(torrent.id).await;
// }
// let (old_real_uploaded, old_real_downloaded) = arc

View File

@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE torrents\n SET\n completed = completed + 1\n WHERE\n id = $1\n ",
"query": "\n UPDATE torrents\n SET\n times_completed = times_completed + 1\n WHERE\n id = $1\n ",
"describe": {
"columns": [],
"parameters": {
@@ -10,5 +10,5 @@
},
"nullable": []
},
"hash": "108ccfa244fb15e63f65c8a69d05b8c5fe3f57854967ded2cfe7af277e1de6b9"
"hash": "10c2aa62abdbf5f8a82c118710661815b93b6d6df5742722faad5f9671af4ac3"
}

View File

@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n id, upload_factor, download_factor, seeders, leechers,\n completed, snatched, edition_group_id, created_at, updated_at,\n created_by_id,\n deleted_at AS \"deleted_at!: _\",\n deleted_by_id AS \"deleted_by_id!: _\",\n extras AS \"extras!: _\",\n languages AS \"languages!: _\",\n release_name, release_group, description, file_amount_per_type,\n uploaded_as_anonymous, file_list, mediainfo, trumpable, staff_checked,\n container, size, duration,\n audio_codec AS \"audio_codec: _\",\n audio_bitrate,\n audio_bitrate_sampling AS \"audio_bitrate_sampling: _\",\n audio_channels AS \"audio_channels: _\",\n video_codec AS \"video_codec: _\",\n features AS \"features!: _\",\n subtitle_languages AS \"subtitle_languages!: _\",\n video_resolution AS \"video_resolution!: _\",\n video_resolution_other_x,\n video_resolution_other_y\n FROM torrents\n WHERE id = $1 AND deleted_at is NULL\n ",
"query": "\n SELECT\n id, upload_factor, download_factor, seeders, leechers,\n times_completed, snatched, edition_group_id, created_at, updated_at,\n created_by_id,\n deleted_at AS \"deleted_at!: _\",\n deleted_by_id AS \"deleted_by_id!: _\",\n extras AS \"extras!: _\",\n languages AS \"languages!: _\",\n release_name, release_group, description, file_amount_per_type,\n uploaded_as_anonymous, file_list, mediainfo, trumpable, staff_checked,\n container, size, duration,\n audio_codec AS \"audio_codec: _\",\n audio_bitrate,\n audio_bitrate_sampling AS \"audio_bitrate_sampling: _\",\n audio_channels AS \"audio_channels: _\",\n video_codec AS \"video_codec: _\",\n features AS \"features!: _\",\n subtitle_languages AS \"subtitle_languages!: _\",\n video_resolution AS \"video_resolution!: _\",\n video_resolution_other_x,\n video_resolution_other_y\n FROM torrents\n WHERE id = $1 AND deleted_at is NULL\n ",
"describe": {
"columns": [
{
@@ -30,8 +30,8 @@
},
{
"ordinal": 5,
"name": "completed",
"type_info": "Int8"
"name": "times_completed",
"type_info": "Int4"
},
{
"ordinal": 6,
@@ -504,5 +504,5 @@
true
]
},
"hash": "6a511bc45afdaa9205a2fa2ff360a9acd9a0e5c66e41d012c88db347f8991a07"
"hash": "840f4fe4178c9746d4bb4258aed340b11fa64db9e1efe5e39cf4c927e0954c54"
}

View File

@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n id,\n upload_factor,\n download_factor,\n seeders,\n leechers,\n completed\n FROM torrents\n ",
"query": "\n SELECT\n id,\n upload_factor,\n download_factor,\n seeders,\n leechers,\n times_completed\n FROM torrents\n ",
"describe": {
"columns": [
{
@@ -30,8 +30,8 @@
},
{
"ordinal": 5,
"name": "completed",
"type_info": "Int8"
"name": "times_completed",
"type_info": "Int4"
}
],
"parameters": {
@@ -46,5 +46,5 @@
false
]
},
"hash": "9a005f6e33977b003ca157711fb83fe4f96aca8348097fce5db85bb0fb709d5a"
"hash": "aa81a92598340d8727f85591fe18aef25e0f81c0b3a94c9154a52f9b33452fbd"
}

View File

@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE torrents\n SET\n release_name = $2,\n release_group = $3,\n description = $4,\n uploaded_as_anonymous = $5,\n mediainfo = $6,\n container = $7,\n duration = $8,\n audio_codec = $9,\n audio_bitrate = $10,\n audio_bitrate_sampling = $11,\n audio_channels = $12,\n video_codec = $13,\n features = $14,\n subtitle_languages = $15,\n video_resolution = $16,\n video_resolution_other_x = $17,\n video_resolution_other_y = $18,\n languages = $19,\n extras = $20,\n updated_at = NOW()\n WHERE id = $1 AND deleted_at IS NULL\n RETURNING\n id, upload_factor, download_factor, seeders, leechers,\n completed, snatched, edition_group_id, created_at, updated_at,\n created_by_id,\n deleted_at AS \"deleted_at!: _\",\n deleted_by_id AS \"deleted_by_id!: _\",\n extras AS \"extras!: _\",\n languages AS \"languages!: _\",\n release_name, release_group, description, file_amount_per_type,\n uploaded_as_anonymous, file_list, mediainfo, trumpable, staff_checked,\n container, size, duration,\n audio_codec AS \"audio_codec: _\",\n audio_bitrate,\n audio_bitrate_sampling AS \"audio_bitrate_sampling: _\",\n audio_channels AS \"audio_channels: _\",\n video_codec AS \"video_codec: _\",\n features AS \"features!: _\",\n subtitle_languages AS \"subtitle_languages!: _\",\n video_resolution AS \"video_resolution!: _\",\n video_resolution_other_x,\n video_resolution_other_y\n ",
"query": "\n UPDATE torrents\n SET\n release_name = $2,\n release_group = $3,\n description = $4,\n uploaded_as_anonymous = $5,\n mediainfo = $6,\n container = $7,\n duration = $8,\n audio_codec = $9,\n audio_bitrate = $10,\n audio_bitrate_sampling = $11,\n audio_channels = $12,\n video_codec = $13,\n features = $14,\n subtitle_languages = $15,\n video_resolution = $16,\n video_resolution_other_x = $17,\n video_resolution_other_y = $18,\n languages = $19,\n extras = $20,\n updated_at = NOW()\n WHERE id = $1 AND deleted_at IS NULL\n RETURNING\n id, upload_factor, download_factor, seeders, leechers,\n times_completed, snatched, edition_group_id, created_at, updated_at,\n created_by_id,\n deleted_at AS \"deleted_at!: _\",\n deleted_by_id AS \"deleted_by_id!: _\",\n extras AS \"extras!: _\",\n languages AS \"languages!: _\",\n release_name, release_group, description, file_amount_per_type,\n uploaded_as_anonymous, file_list, mediainfo, trumpable, staff_checked,\n container, size, duration,\n audio_codec AS \"audio_codec: _\",\n audio_bitrate,\n audio_bitrate_sampling AS \"audio_bitrate_sampling: _\",\n audio_channels AS \"audio_channels: _\",\n video_codec AS \"video_codec: _\",\n features AS \"features!: _\",\n subtitle_languages AS \"subtitle_languages!: _\",\n video_resolution AS \"video_resolution!: _\",\n video_resolution_other_x,\n video_resolution_other_y\n ",
"describe": {
"columns": [
{
@@ -30,8 +30,8 @@
},
{
"ordinal": 5,
"name": "completed",
"type_info": "Int8"
"name": "times_completed",
"type_info": "Int4"
},
{
"ordinal": 6,
@@ -793,5 +793,5 @@
true
]
},
"hash": "49f9cf141cc03ec493d7aedc1d83790fea64a61959c7b94fe4aecc12c7d4cc9e"
"hash": "bb6c8c54e372a54f7a8345ce2308f10a11e77d60305e1e865f2e2e28da9ee622"
}

View File

@@ -434,7 +434,7 @@ CREATE TABLE torrents (
download_factor FLOAT NOT NULL DEFAULT 1.0,
seeders BIGINT NOT NULL DEFAULT 0,
leechers BIGINT NOT NULL DEFAULT 0,
completed BIGINT NOT NULL DEFAULT 0,
times_completed INT NOT NULL DEFAULT 0,
snatched BIGINT NOT NULL DEFAULT 0,
edition_group_id INT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
@@ -550,7 +550,7 @@ CREATE TABLE torrent_reports (
);
CREATE TABLE peers (
peer_id bytea NOT NULL,
ip bytea NOT NULL,
ip INET NOT NULL,
port smallint NOT NULL,
agent varchar(64) NOT NULL,
uploaded bigint NOT NULL,
@@ -857,7 +857,7 @@ SELECT
t.download_factor,
t.seeders,
t.leechers,
t.completed,
t.times_completed,
t.edition_group_id,
t.created_at,
t.updated_at,
@@ -973,7 +973,7 @@ ORDER BY
'torrents', COALESCE(jsonb_agg(
jsonb_strip_nulls(jsonb_build_object(
'id', ft.id, 'upload_factor', ft.upload_factor, 'download_factor', ft.download_factor,
'seeders', ft.seeders, 'leechers', ft.leechers, 'completed', ft.completed,
'seeders', ft.seeders, 'leechers', ft.leechers, 'times_completed', ft.times_completed,
'edition_group_id', ft.edition_group_id, 'created_at', ft.created_at, 'extras', ft.extras,
'release_name', ft.release_name, 'release_group', ft.release_group,
'file_amount_per_type', ft.file_amount_per_type, 'trumpable', ft.trumpable,

View File

@@ -311,7 +311,7 @@ pub struct Torrent {
pub download_factor: f64,
pub seeders: i64,
pub leechers: i64,
pub completed: i64,
pub times_completed: i32,
pub snatched: i64,
pub edition_group_id: i32,
#[schema(value_type = String, format = DateTime)]
@@ -481,7 +481,7 @@ pub struct TorrentHierarchyLite {
pub download_factor: f64,
pub seeders: i64,
pub leechers: i64,
pub completed: i64,
pub times_completed: i32,
pub snatched: i64,
pub edition_group_id: i32,
#[schema(value_type = String, format = DateTime)]
@@ -528,7 +528,7 @@ pub struct TorrentHierarchy {
pub download_factor: f64,
pub seeders: i64,
pub leechers: i64,
pub completed: i64,
pub times_completed: i32,
pub snatched: i64,
pub edition_group_id: i32,
#[schema(value_type = String, format = DateTime)]

View File

@@ -207,7 +207,7 @@ impl ConnectionPool {
r#"
SELECT
id, upload_factor, download_factor, seeders, leechers,
completed, snatched, edition_group_id, created_at, updated_at,
times_completed, snatched, edition_group_id, created_at, updated_at,
created_by_id,
deleted_at AS "deleted_at!: _",
deleted_by_id AS "deleted_by_id!: _",
@@ -271,7 +271,7 @@ impl ConnectionPool {
WHERE id = $1 AND deleted_at IS NULL
RETURNING
id, upload_factor, download_factor, seeders, leechers,
completed, snatched, edition_group_id, created_at, updated_at,
times_completed, snatched, edition_group_id, created_at, updated_at,
created_by_id,
deleted_at AS "deleted_at!: _",
deleted_by_id AS "deleted_by_id!: _",
@@ -540,12 +540,12 @@ impl ConnectionPool {
// Ok(())
// }
pub async fn increment_torrent_completed(&self, torrent_id: i32) -> Result<()> {
pub async fn increment_torrent_times_completed(&self, torrent_id: i32) -> Result<()> {
let _ = sqlx::query!(
r#"
UPDATE torrents
SET
completed = completed + 1
times_completed = times_completed + 1
WHERE
id = $1
"#,

View File

@@ -53,7 +53,7 @@ impl ConnectionPool {
download_factor,
seeders,
leechers,
completed
times_completed
FROM torrents
"#
)
@@ -69,7 +69,7 @@ impl ConnectionPool {
download_factor: r.download_factor,
seeders: r.seeders,
leechers: r.leechers,
completed: r.completed,
times_completed: r.times_completed,
};
map.insert(id, torrent);
}

View File

@@ -1844,7 +1844,7 @@ export interface components {
audio_channels?: null | components["schemas"]["AudioChannels"];
audio_codec?: null | components["schemas"]["AudioCodec"];
/** Format: int64 */
completed: number;
times_completed: number;
container: string;
/** Format: date-time */
created_at: string;
@@ -1901,7 +1901,7 @@ export interface components {
audio_channels?: null | components["schemas"]["AudioChannels"];
audio_codec?: null | components["schemas"]["AudioCodec"];
/** Format: int64 */
completed: number;
times_completed: number;
container: string;
/** Format: date-time */
created_at: string;
@@ -1961,7 +1961,7 @@ export interface components {
audio_channels?: string | null;
audio_codec?: null | components["schemas"]["AudioCodec"];
/** Format: int64 */
completed: number;
times_completed: number;
container: string;
/** Format: date-time */
created_at: string;

View File

@@ -60,9 +60,9 @@
<!-- TODO: replace with real data from the tracker -->
<Column style="width: 2em">
<template #header>
<i class="pi pi-replay" v-tooltip.top="t('torrent.completed')" />
<i class="pi pi-replay" v-tooltip.top="t('torrent.times_completed')" />
</template>
<template #body="slotProps">{{ slotProps.data.completed }}</template>
<template #body="slotProps">{{ slotProps.data.times_completed }}</template>
</Column>
<Column style="width: 2em">
<template #header>

View File

@@ -214,7 +214,7 @@
"torrent": "Torrent | Torrents",
"seeders": "Seeders",
"leechers": "Leechers",
"completed": "Completed",
"times_completed": "Completed",
"created_at": "Uploaded at",
"upload_torrent": "Upload torrent",
"request_format": "Request format",

View File

@@ -199,7 +199,7 @@ const titleGroupStore = useTitleGroupStore()
const editTitleGroupDialogVisible = ref(false)
// TODO: add by extras
const selectableSortingOptions = ['edition', 'size', 'seeders', 'completed', 'created_at']
const selectableSortingOptions = ['edition', 'size', 'seeders', 'times_completed', 'created_at']
const titleGroupAndAssociatedData = ref<TitleGroupAndAssociatedData>()
const sortBy = ref('edition')

View File

@@ -14,7 +14,7 @@ pub struct Torrent {
pub download_factor: f64,
pub seeders: i64,
pub leechers: i64,
pub completed: i64,
pub times_completed: i32,
}
#[derive(Debug, bincode::Encode, bincode::Decode)]