diff --git a/src/modes/server/pages.rs b/src/modes/server/pages.rs
index 84ab692..085d8bd 100644
--- a/src/modes/server/pages.rs
+++ b/src/modes/server/pages.rs
@@ -5,6 +5,7 @@ use axum::{
extract::{Path, Query, State},
response::{Html, Response},
};
+use log::debug;
use rusqlite::Connection;
use serde::Deserialize;
use crate::config::ColumnConfig;
@@ -94,6 +95,13 @@ fn build_item_list(conn: &Connection, params: &ListQueryParams, columns: &[Colum
let tags_map = db::get_tags_for_items(conn, &item_ids)?;
let meta_map = db::get_meta_for_items(conn, &item_ids)?;
+ // Debug: print number of tags per item
+ for item_id in &item_ids {
+ if let Some(tags) = tags_map.get(item_id) {
+ debug!("Item {} has {} tags: {:?}", item_id, tags.len(), tags);
+ }
+ }
+
let mut html = String::new();
html.push_str("
Items");
html.push_str("");
@@ -104,7 +112,7 @@ fn build_item_list(conn: &Connection, params: &ListQueryParams, columns: &[Colum
// Add recent tags section using the items we already have
html.push_str("
Recent Tags
");
- // Collect all tags from the items, keeping track of their timestamps
+ // Collect all tags from all items, keeping track of their timestamps
let mut all_tags_with_time: Vec<(String, chrono::DateTime)> = Vec::new();
for item in &sorted_items {
if let Some(item_id) = item.id {
@@ -116,7 +124,7 @@ fn build_item_list(conn: &Connection, params: &ListQueryParams, columns: &[Colum
}
}
- // Sort by timestamp descending and deduplicate
+ // Sort by timestamp descending (most recent first)
all_tags_with_time.sort_by(|a, b| b.1.cmp(&a.1));
// Get unique tags in order of most recent appearance
@@ -176,10 +184,11 @@ fn build_item_list(conn: &Connection, params: &ListQueryParams, columns: &[Colum
"time" => item.ts.format("%Y-%m-%d %H:%M:%S").to_string(),
"size" => item.size.map(|s| s.to_string()).unwrap_or_default(),
"tags" => {
- tags.iter()
+ // Make sure we're using all tags for the item
+ let tag_links: Vec = tags.iter()
.map(|t| format!("{}", t.name, t.name))
- .collect::>()
- .join(", ")
+ .collect();
+ tag_links.join(", ")
},
_ => {
if column.name.starts_with("meta:") {