Skip to content

Commit

Permalink
remove sass, fix content tree report
Browse files Browse the repository at this point in the history
  • Loading branch information
sfs-88 authored and kentico-ericd committed May 13, 2024
1 parent e1f3c28 commit b4c0fcc
Show file tree
Hide file tree
Showing 4 changed files with 457 additions and 2,240 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Globalization;
using System.Text;

namespace KenticoInspector.Reports.ContentTreeConsistencyAnalysis.Models
{
Expand Down Expand Up @@ -30,7 +31,7 @@ public VersionHistoryMismatchResult(int documentID, string fieldName, string fie
FieldName = fieldName;
ProcessItemValues(fieldType, versionHistoryXmlValue, coupledDataColumnValue);
}

private void ProcessItemValues(string fieldType, string versionHistoryXmlValue, object coupledDataColumnValue)
{
var hasAtLeastOneNullValue = versionHistoryXmlValue == null || coupledDataColumnValue == null;
Expand Down Expand Up @@ -74,22 +75,31 @@ private void ProcessDecimalValues(string versionHistoryXmlValue, object coupledD

var versionHistoryValue = decimal.Parse(versionHistoryXmlValue);

var formatting = "0.";
var formatting = new StringBuilder("0.");
for (int i = 0; i < precision; i++)
{
formatting += "0";
formatting.Append('0');
}

VersionHistoryValue = versionHistoryValue.ToString(formatting);
VersionHistoryValue = versionHistoryValue.ToString(formatting.ToString());
}

private void ProcessDateTimeValues(string versionHistoryXmlValue, object coupledDataColumnValue)
{
var versionHistoryValue = DateTimeOffset.Parse(versionHistoryXmlValue);
var assumedOffset = versionHistoryValue.Offset;
var documentValueAdjusted = new DateTimeOffset((DateTime)coupledDataColumnValue, assumedOffset);
DocumentValue = documentValueAdjusted.ToString();
VersionHistoryValue = versionHistoryValue.ToString();
DateTimeOffset versionHistoryValue;
DateTime coupledDataDateTime = DateTime.Parse(coupledDataColumnValue.ToString());
if (DateTimeOffset.TryParse(versionHistoryXmlValue, out versionHistoryValue) && coupledDataDateTime.Year != 1)
{
var assumedOffset = versionHistoryValue.Offset;
var documentValueAdjusted = new DateTimeOffset(coupledDataDateTime, assumedOffset);
DocumentValue = documentValueAdjusted.ToString();
VersionHistoryValue = versionHistoryValue.ToString();
}
else
{
DocumentValue = versionHistoryXmlValue.ToString();
VersionHistoryValue = versionHistoryXmlValue.ToString();
}
}

private void ProcessBoolValues(string versionHistoryXmlValue, object coupledDataColumnValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ private ReportResults GetWorkflowInconsistencyResult()
foreach (var cmsClass in cmsClassItems)
{
var cmsClassVersionHistoryItems = versionHistoryItems.Where(vhi => vhi.VersionClassID == cmsClass.ClassID);
var coupledDataIds = cmsClassVersionHistoryItems.Select(x => x.CoupledDataID);
var coupledDataIds = cmsClassVersionHistoryItems.Select(x => x.CoupledDataID).Where(x => x > 0);
if (!coupledDataIds.Any())
{
continue;
}

var coupledData = GetCoupledData(cmsClass, coupledDataIds);
var classComparisionResults = CompareVersionHistoryItemsWithPublishedItems(versionHistoryItems, coupledData, cmsClass.ClassFields);
comparisonResults.AddRange(classComparisionResults);
Expand Down
Loading

0 comments on commit b4c0fcc

Please sign in to comment.