Skip to content

Commit

Permalink
Bug fix query semanticID
Browse files Browse the repository at this point in the history
  • Loading branch information
aorzelskiGH committed Jul 24, 2024
1 parent dc99847 commit b90c93a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/AasxServerDB/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId

private static void GetDValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string equal = "", string lower = "", string upper = "")
{
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
var withEqual = !equal.IsNullOrEmpty();
var withCompare = !(lower.IsNullOrEmpty() && upper.IsNullOrEmpty());
if (!withSME && !withDiff && !withEqual && !withCompare)
if (!withSemanticID && !withDiff && !withEqual && !withCompare)
return;

var dEqual = (long) 0;
Expand Down Expand Up @@ -483,19 +483,19 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
.Join(
(db.SMESets
.Where(sme =>
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0))),
v => v.SMEId, sme => sme.Id, (v, sme) => new SMEWithValue { sme = sme, value = v.Value.ToString() })
.ToList());
}

private static void GetOValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string contains = "", string equal = "")
{
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
var withContains = !contains.IsNullOrEmpty();
var withEqual = !equal.IsNullOrEmpty();
if (!withSME && !withDiff && !withContains && !withEqual)
if (!withSemanticID && !withDiff && !withContains && !withEqual)
return;

using AasContext db = new();
Expand All @@ -506,7 +506,7 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
.Join(
db.SMESets
.Where(sme =>
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0)),
v => v.SMEId, sme => sme.Id, (v, sme) => new SMEWithValue { sme = sme, value = (string) v.Value })
.ToList());
Expand Down

0 comments on commit b90c93a

Please sign in to comment.