diff --git a/Mimante/Pages/AuctionBrowser.razor b/Mimante/Pages/AuctionBrowser.razor index 2d45b1c..3c56bcd 100644 --- a/Mimante/Pages/AuctionBrowser.razor +++ b/Mimante/Pages/AuctionBrowser.razor @@ -547,7 +547,6 @@ private bool isUpdatingInBackground = false; CheckAuctionOpenBeforeBid = settings.DefaultCheckAuctionOpenBeforeBid, MinPrice = settings.DefaultMinPrice, MaxPrice = settings.DefaultMaxPrice, - MaxClicks = settings.DefaultMaxClicks, MinResets = settings.DefaultMinResets, MaxResets = settings.DefaultMaxResets, diff --git a/Mimante/Pages/Index.razor b/Mimante/Pages/Index.razor index 54b8322..be38020 100644 --- a/Mimante/Pages/Index.razor +++ b/Mimante/Pages/Index.razor @@ -237,14 +237,10 @@
|
@@ -440,11 +439,12 @@
- @if (selectedAuction.RecentBids != null && selectedAuction.RecentBids.Any())
+ @{
+ // Crea una copia thread-safe per evitare modifiche durante l'enumerazione
+ var recentBidsCopy = GetRecentBidsSafe(selectedAuction);
+ }
+ @if (recentBidsCopy.Any())
{
- // Crea una copia locale per evitare modifiche durante l'enumerazione
- var recentBidsCopy = selectedAuction.RecentBids.ToList();
-
// Calcola statistiche puntatori
var bidderStats = recentBidsCopy
.GroupBy(b => b.Username)
@@ -574,8 +574,3 @@
- v1.0.0
-
diff --git a/Mimante/Pages/Index.razor.cs b/Mimante/Pages/Index.razor.cs
index baa4579..4ace39e 100644
--- a/Mimante/Pages/Index.razor.cs
+++ b/Mimante/Pages/Index.razor.cs
@@ -385,7 +385,6 @@ namespace AutoBidder.Pages
CheckAuctionOpenBeforeBid = settings.DefaultCheckAuctionOpenBeforeBid,
MinPrice = settings.DefaultMinPrice,
MaxPrice = settings.DefaultMaxPrice,
- MaxClicks = settings.DefaultMaxClicks,
MinResets = settings.DefaultMinResets,
MaxResets = settings.DefaultMaxResets,
IsActive = isActive,
@@ -748,22 +747,8 @@ namespace AutoBidder.Pages
private string GetStatusAnimationClass(AuctionInfo auction)
{
- // Animazioni per stati speciali
- if (auction.LastState != null)
- {
- switch (auction.LastState.Status)
- {
- case AuctionStatus.EndedWon:
- return "status-anim-won";
- case AuctionStatus.Running when auction.IsAttackInProgress:
- return "status-anim-attacking";
- }
- }
-
- if (!auction.IsActive) return "";
- if (auction.IsPaused) return "status-anim-paused";
- if (auction.IsAttackInProgress) return "status-anim-attacking";
- return "status-anim-active";
+ // Animazioni disabilitate - i colori sono sufficienti per identificare lo stato
+ return "";
}
private string GetPriceDisplay(AuctionInfo? auction)
@@ -990,6 +975,29 @@ namespace AutoBidder.Pages
return auction.AuctionLog.TakeLast(50);
}
+ ///
+
+
+
+ + ++
+
+
+
+
+ Salvataggio Automatico+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 = mantieni tutto | 180 = 6 mesi (consigliato)
+ Pulizia Automatica all'Avvio+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Manutenzione Manuale+
+
+
+
+
+
+ Duplicati:
+
+ @dbDuplicatesCount
+
+ Incompleti:
+
+ @dbIncompleteCount
+
+
+
+
+
+
+
+
+
+
+ @if (!string.IsNullOrEmpty(dbCleanupMessage))
+ {
+
+
+ @dbCleanupMessage
+
+ }
+
+
+
+
+
+
@@ -423,6 +604,159 @@ private System.Threading.Timer? updateTimer;
return "bg-success";
}
+ // ???????????????????????????????????????????????????????????????
+ // DATABASE MANAGEMENT
+ // ???????????????????????????????????????????????????????????????
+
+ [Inject] private DatabaseService DbService { get; set; } = default!;
+
+ private int dbDuplicatesCount = 0;
+ private int dbIncompleteCount = 0;
+ private bool isLoadingDbStats = false;
+ private bool isCleaningDb = false;
+ private string? dbCleanupMessage = null;
+ private bool dbCleanupSuccess = false;
+
+ private async Task RefreshDbStats()
+ {
+ if (!DbService.IsAvailable) return;
+
+ isLoadingDbStats = true;
+ dbCleanupMessage = null;
+ StateHasChanged();
+
+ try
+ {
+ dbDuplicatesCount = await DbService.CountDuplicateAuctionResultsAsync();
+ dbIncompleteCount = await DbService.CountIncompleteAuctionResultsAsync();
+ }
+ catch (Exception ex)
+ {
+ dbCleanupMessage = $"Errore: {ex.Message}";
+ dbCleanupSuccess = false;
+ }
+ finally
+ {
+ isLoadingDbStats = false;
+ StateHasChanged();
+ }
+ }
+
+ private async Task CleanupDuplicates()
+ {
+ if (!DbService.IsAvailable) return;
+
+ isCleaningDb = true;
+ dbCleanupMessage = null;
+ StateHasChanged();
+
+ try
+ {
+ var removed = await DbService.RemoveDuplicateAuctionResultsAsync();
+ dbCleanupMessage = $"? Rimossi {removed} record duplicati";
+ dbCleanupSuccess = true;
+ await RefreshDbStats();
+ }
+ catch (Exception ex)
+ {
+ dbCleanupMessage = $"Errore: {ex.Message}";
+ dbCleanupSuccess = false;
+ }
+ finally
+ {
+ isCleaningDb = false;
+ StateHasChanged();
+ }
+ }
+
+ private async Task CleanupIncomplete()
+ {
+ if (!DbService.IsAvailable) return;
+
+ isCleaningDb = true;
+ dbCleanupMessage = null;
+ StateHasChanged();
+
+ try
+ {
+ var removed = await DbService.RemoveIncompleteAuctionResultsAsync();
+ dbCleanupMessage = $"? Rimossi {removed} record incompleti";
+ dbCleanupSuccess = true;
+ await RefreshDbStats();
+ }
+ catch (Exception ex)
+ {
+ dbCleanupMessage = $"Errore: {ex.Message}";
+ dbCleanupSuccess = false;
+ }
+ finally
+ {
+ isCleaningDb = false;
+ StateHasChanged();
+ }
+ }
+
+ private async Task CleanupDatabase()
+ {
+ if (!DbService.IsAvailable) return;
+
+ isCleaningDb = true;
+ dbCleanupMessage = null;
+ StateHasChanged();
+
+ try
+ {
+ var message = await DbService.CleanupDatabaseAsync();
+ dbCleanupMessage = $"? {message}";
+ dbCleanupSuccess = true;
+ await RefreshDbStats();
+ }
+ catch (Exception ex)
+ {
+ dbCleanupMessage = $"Errore: {ex.Message}";
+ dbCleanupSuccess = false;
+ }
+ finally
+ {
+ isCleaningDb = false;
+ StateHasChanged();
+ }
+ }
+
+ private async Task OptimizeDatabase()
+ {
+ if (!DbService.IsAvailable) return;
+
+ isCleaningDb = true;
+ dbCleanupMessage = null;
+ StateHasChanged();
+
+ try
+ {
+ await DbService.OptimizeDatabaseAsync();
+ dbCleanupMessage = "? Database ottimizzato (VACUUM eseguito)";
+ dbCleanupSuccess = true;
+ }
+ catch (Exception ex)
+ {
+ dbCleanupMessage = $"Errore: {ex.Message}";
+ dbCleanupSuccess = false;
+ }
+ finally
+ {
+ isCleaningDb = false;
+ StateHasChanged();
+ }
+ }
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ if (firstRender && DbService.IsAvailable)
+ {
+ await RefreshDbStats();
+ }
+ }
+
public void Dispose()
{
updateTimer?.Dispose();
diff --git a/Mimante/Program.cs b/Mimante/Program.cs
index 1c49bee..63db6c3 100644
--- a/Mimante/Program.cs
+++ b/Mimante/Program.cs
@@ -277,6 +277,55 @@ using (var scope = app.Services.CreateScope())
var isHealthy = await databaseService.CheckDatabaseHealthAsync();
Console.WriteLine($"[DB] Database health check: {(isHealthy ? "OK" : "FAILED")}");
+ // π₯ MANUTENZIONE AUTOMATICA DATABASE
+ var settings = AutoBidder.Utilities.SettingsManager.Load();
+
+ if (settings.DatabaseAutoCleanupDuplicates)
+ {
+ Console.WriteLine("[DB] Checking for duplicate records...");
+ var duplicateCount = await databaseService.CountDuplicateAuctionResultsAsync();
+ if (duplicateCount > 0)
+ {
+ Console.WriteLine($"[DB] Found {duplicateCount} duplicates - removing...");
+ var removed = await databaseService.RemoveDuplicateAuctionResultsAsync();
+ Console.WriteLine($"[DB] β Removed {removed} duplicate auction results");
+ }
+ else
+ {
+ Console.WriteLine("[DB] β No duplicates found");
+ }
+ }
+
+ if (settings.DatabaseAutoCleanupIncomplete)
+ {
+ Console.WriteLine("[DB] Checking for incomplete records...");
+ var incompleteCount = await databaseService.CountIncompleteAuctionResultsAsync();
+ if (incompleteCount > 0)
+ {
+ Console.WriteLine($"[DB] Found {incompleteCount} incomplete records - removing...");
+ var removed = await databaseService.RemoveIncompleteAuctionResultsAsync();
+ Console.WriteLine($"[DB] β Removed {removed} incomplete auction results");
+ }
+ else
+ {
+ Console.WriteLine("[DB] β No incomplete records found");
+ }
+ }
+
+ if (settings.DatabaseMaxRetentionDays > 0)
+ {
+ Console.WriteLine($"[DB] Checking for records older than {settings.DatabaseMaxRetentionDays} days...");
+ var oldCount = await databaseService.RemoveOldAuctionResultsAsync(settings.DatabaseMaxRetentionDays);
+ if (oldCount > 0)
+ {
+ Console.WriteLine($"[DB] β Removed {oldCount} old auction results");
+ }
+ else
+ {
+ Console.WriteLine($"[DB] β No old records to remove");
+ }
+ }
+
// π Esegui diagnostica completa se ci sono problemi o se richiesto
var runDiagnostics = Environment.GetEnvironmentVariable("DB_DIAGNOSTICS")?.ToLower() == "true";
if (!isHealthy || runDiagnostics)
diff --git a/Mimante/Services/AuctionMonitor.cs b/Mimante/Services/AuctionMonitor.cs
index b921b3f..3638448 100644
--- a/Mimante/Services/AuctionMonitor.cs
+++ b/Mimante/Services/AuctionMonitor.cs
@@ -176,9 +176,8 @@ namespace AutoBidder.Services
auction.MaxPrice = maxPrice;
auction.MinResets = minResets;
auction.MaxResets = maxResets;
- auction.MaxClicks = maxBids;
- OnLog?.Invoke($"[LIMITS] Aggiornati limiti per {auction.Name}: MinPrice={minPrice:F2}, MaxPrice={maxPrice:F2}, MinResets={minResets}, MaxResets={maxResets}, MaxBids={maxBids}");
+ OnLog?.Invoke($"[LIMITS] Aggiornati limiti per {auction.Name}: MinPrice={minPrice:F2}, MaxPrice={maxPrice:F2}, MinResets={minResets}, MaxResets={maxResets}");
return true;
}
}
@@ -202,7 +201,6 @@ namespace AutoBidder.Services
auction.MaxPrice = maxPrice;
auction.MinResets = minResets;
auction.MaxResets = maxResets;
- auction.MaxClicks = maxBids;
count++;
OnLog?.Invoke($"[LIMITS] Aggiornati limiti per {auction.Name}");
@@ -653,14 +651,6 @@ namespace AutoBidder.Services
return false;
}
- // ??? CONTROLLO 5: MaxClicks
- int myBidsCount = auction.BidHistory.Count(b => b.EventType == BidEventType.MyBid);
- if (auction.MaxClicks > 0 && myBidsCount >= auction.MaxClicks)
- {
- auction.AddLog($"[CLICKS] Click massimi raggiunti: {myBidsCount} >= Max {auction.MaxClicks}");
- return false;
- }
-
// ?? CONTROLLO 6: Cooldown (evita puntate multiple ravvicinate)
if (auction.LastClickAt.HasValue)
{
diff --git a/Mimante/Services/BidooBrowserService.cs b/Mimante/Services/BidooBrowserService.cs
index 9a5108a..1e13150 100644
--- a/Mimante/Services/BidooBrowserService.cs
+++ b/Mimante/Services/BidooBrowserService.cs
@@ -219,15 +219,20 @@ namespace AutoBidder.Services
// Parse aste dall'HTML (fragment AJAX)
auctions = ParseAuctionsFromHtml(html);
- // ?? FIX: Filtra solo aste di puntate se categoria "Aste di Puntate" (TabId = 1)
+ Console.WriteLine($"[BidooBrowser] Trovate {auctions.Count} aste nella categoria {category.DisplayName}");
+
+ // ?? DEBUG: Verifica quante aste hanno IsCreditAuction = true
if (category.IsSpecialCategory && category.TabId == 1)
{
- var before = auctions.Count;
- auctions = auctions.Where(a => a.IsCreditAuction).ToList();
- Console.WriteLine($"[BidooBrowser] Filtrate {before} -> {auctions.Count} aste di puntate (IsCreditAuction = true)");
+ var creditCount = auctions.Count(a => a.IsCreditAuction);
+ Console.WriteLine($"[BidooBrowser] DEBUG Aste di Puntate: {creditCount}/{auctions.Count} hanno IsCreditAuction=true");
+
+ // Log primi 3 nomi per debug
+ foreach (var a in auctions.Take(3))
+ {
+ Console.WriteLine($"[BidooBrowser] - {a.Name} (ID: {a.AuctionId}, IsCreditAuction: {a.IsCreditAuction})");
+ }
}
-
- Console.WriteLine($"[BidooBrowser] Trovate {auctions.Count} aste nella categoria {category.DisplayName}");
}
catch (Exception ex)
{
diff --git a/Mimante/Services/DatabaseService.cs b/Mimante/Services/DatabaseService.cs
index da13c5a..9850ca1 100644
--- a/Mimante/Services/DatabaseService.cs
+++ b/Mimante/Services/DatabaseService.cs
@@ -1037,6 +1037,7 @@ namespace AutoBidder.Services
/// + ++
+
+
+
+
+
+
+
+
+
+
+
+ Versione+
+
+ v1.0.0
+
+
+
+
+
+
+
+ Ambiente+
+
+ .NET 8
+
+
+
+
+
+
+
+ Informazioni Sistema+
+
+
+ Database:
+
+
+ @if (DbService.IsAvailable)
+ {
+ Operativo
+ }
+ else
+ {
+ Non disponibile
+ }
+
+
+ Sessione:
+
+
+ @if (!string.IsNullOrEmpty(currentUsername))
+ {
+ @currentUsername
+ }
+ else
+ {
+ Non connesso
+ }
+
+ |