fix: v1.5.6 - skip NTT tickets with closed status override; restore On Hold sidebar panel
This commit is contained in:
@@ -9,7 +9,14 @@ namespace Disco.Plugins.ServiceTracker.Services
|
||||
{
|
||||
public class ServiceTrackerService
|
||||
{
|
||||
public const string PluginVersion = "1.5.5";
|
||||
public const string PluginVersion = "1.5.6";
|
||||
|
||||
/// <summary>
|
||||
/// Status values that mean a ticket is closed/done. Checked against the saved StatusOverride
|
||||
/// for NTT tickets so that manually resolved/dismissed sheet jobs don't reappear.
|
||||
/// </summary>
|
||||
private static readonly string[] ClosedStatusKeywords = new[] { "resolved", "dismissed", "complete", "closed", "done", "cancel", "finished" };
|
||||
|
||||
private readonly DiscoDataContext _database;
|
||||
private readonly ServiceTrackerDataStore _dataStore;
|
||||
private readonly ServiceTrackerConfig _config;
|
||||
@@ -42,7 +49,19 @@ namespace Disco.Plugins.ServiceTracker.Services
|
||||
var ext = _dataStore.LoadExternalTickets(); var el = ext.ToDictionary(t => t.JobId, t => t);
|
||||
foreach (var e in sr.Tickets)
|
||||
{
|
||||
ServiceTicket st; if (!el.TryGetValue(e.InternalId, out st))
|
||||
ServiceTicket st; el.TryGetValue(e.InternalId, out st);
|
||||
|
||||
// Skip if the ticket has been manually closed/resolved/dismissed in the tracker,
|
||||
// even if the sheet row still appears open.
|
||||
if (st != null && !string.IsNullOrEmpty(st.StatusOverride))
|
||||
{
|
||||
var ov = st.StatusOverride.ToLower().Trim();
|
||||
bool manuallyClosed = false;
|
||||
foreach (var kw in ClosedStatusKeywords) { if (ov.Contains(kw)) { manuallyClosed = true; break; } }
|
||||
if (manuallyClosed) continue;
|
||||
}
|
||||
|
||||
if (st == null)
|
||||
{ st = new ServiceTicket { JobId = e.InternalId, Source = "ntt", PriorityId = GoogleSheetService.MapPriority(e.RawPriority), LocationId = _config.DefaultLocationId, AssignedTechId = ResolveSheetTech(e.AssignedTo), Summary = e.IssueDescription, EstimatedCompletion = e.PreferredDate, CreatedDate = e.Timestamp, LastModifiedDate = DateTime.Now }; _dataStore.SaveExternalTicket(st); el[e.InternalId] = st; }
|
||||
tiles.Add(BuildSheetTile(e, st)); sheetCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user