From 7dd4d764760681b7adb010dd91ce6dd512cfd34c Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Thu, 28 Feb 2019 11:58:23 +0000 Subject: [PATCH 01/31] Fixed issue with schemas breaking convention based relationship detection --- Web/Managers/DbManager.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Web/Managers/DbManager.cs b/Web/Managers/DbManager.cs index 73567fd..8150b39 100644 --- a/Web/Managers/DbManager.cs +++ b/Web/Managers/DbManager.cs @@ -397,16 +397,22 @@ private static void SetDbForeignKeys(DbModel dbModel, DatabaseType type, DbConne } } - var tableByIdName = dbModel.Tables.ToDictionary(t => t.Name.ToLower() + "id"); - foreach (var table in dbModel.Tables) { foreach (var column in table.Columns.Select(c => c as Models.DbColumn)) { DbTable dbTable = null; - if (column.IsPrimaryKey == false && column.Parent == null && tableByIdName.TryGetValue(column.Name.ToLower(), out dbTable)) + if (column.IsPrimaryKey == false && column.Parent == null) { - column.Parent = dbTable.Columns[0] as Models.DbColumn; + dbTable = dbModel.Tables.FirstOrDefault(t => + t.Schema == table.Schema && + ((t.Name.ToLower() + "_id") == column.Name.ToLower()) || + ((t.Name.ToLower() + "id") == column.Name.ToLower())); + + if (dbTable != null) + { + column.Parent = dbTable.Columns[0] as Models.DbColumn; + } } } } From 14ec0e2517d5d72f927695544a975dccd7748b6d Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Mon, 1 Jul 2019 17:01:10 +0100 Subject: [PATCH 02/31] Fixing issue #46: Invalid aggregation functions shown --- Web/Scripts/nodes.js | 7 +++++-- Web/Scripts/tools.js | 14 +++++++------- Web/Views/Simple/Create.cshtml | 2 +- Web/Views/Simple/Edit.cshtml | 2 +- Web/wwwroot/partials/Summarize.html | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Web/Scripts/nodes.js b/Web/Scripts/nodes.js index 35895ba..abd6872 100644 --- a/Web/Scripts/nodes.js +++ b/Web/Scripts/nodes.js @@ -845,6 +845,9 @@ nodes.Summarize = function(properties) { return instance.AllInputColumnInfos().filter(function (col) { return tools.IsNumericType(col.Type); }); }); + instance.AggFunctions = ko.computed(function() { + return instance.Tool.AggFunctions().filter(function(aggFunc) { return aggFunc.requiresNumeric === false || instance.AggColumns().length > 0 }); + }); var innerGetCoreSettings = instance.GetCoreSettings; instance.GetCoreSettings = function () { @@ -855,7 +858,7 @@ nodes.Summarize = function(properties) { settings.AggColumnIndexes = []; $.each(instance.Statistics(), function (i, statistic) { settings.AggFunctions.push(statistic.AggFunction()); - settings.AggColumnIndexes.push(statistic.AggColumn()); + settings.AggColumnIndexes.push(statistic.AggColumn()); }); return settings; } @@ -898,7 +901,7 @@ nodes.Summarize = function(properties) { instance.AddStatistic = function () { instance.Statistics.push({ "AggFunction": ko.observable(2), - "AggColumn": ko.observable() + "AggColumn": ko.observable(0) }); }; diff --git a/Web/Scripts/tools.js b/Web/Scripts/tools.js index c275877..d3c559e 100644 --- a/Web/Scripts/tools.js +++ b/Web/Scripts/tools.js @@ -252,12 +252,12 @@ tools.Summarize = function () { }); instance.AggFunctions = ko.observableArray([ - { id: 1, text: "Number of Rows" }, - { id: 2, text: "Total" }, - { id: 3, text: "Minimum" }, - { id: 4, text: "Maximum" }, - { id: 5, text: "Average" }, - { id: 6, text: "Median" } + { id: 1, text: "Number of Rows", requiresNumeric: false }, + { id: 2, text: "Total", requiresNumeric: true }, + { id: 3, text: "Minimum", requiresNumeric: true }, + { id: 4, text: "Maximum", requiresNumeric: true }, + { id: 5, text: "Average", requiresNumeric: true }, + { id: 6, text: "Median", requiresNumeric: true } ]); instance.DateFunctions = ko.observableArray([ @@ -267,7 +267,7 @@ tools.Summarize = function () { ]); instance.MaxInputs = 1; - instance.HelpUrl = "http://querytreeapp.com/help/tools/summarize/"; + instance.HelpUrl = "http://querytreeapp.com/help/tools/statistics/"; return instance; }; diff --git a/Web/Views/Simple/Create.cshtml b/Web/Views/Simple/Create.cshtml index e67fc2d..ff12db3 100644 --- a/Web/Views/Simple/Create.cshtml +++ b/Web/Views/Simple/Create.cshtml @@ -161,7 +161,7 @@
- +
diff --git a/Web/Views/Simple/Edit.cshtml b/Web/Views/Simple/Edit.cshtml index b4c8af2..9032d15 100644 --- a/Web/Views/Simple/Edit.cshtml +++ b/Web/Views/Simple/Edit.cshtml @@ -163,7 +163,7 @@
- +
diff --git a/Web/wwwroot/partials/Summarize.html b/Web/wwwroot/partials/Summarize.html index d51113f..818386d 100644 --- a/Web/wwwroot/partials/Summarize.html +++ b/Web/wwwroot/partials/Summarize.html @@ -6,7 +6,7 @@
- +
From 39c12685fe852521744b4525999f699499097542 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Mon, 1 Jul 2019 17:01:34 +0100 Subject: [PATCH 03/31] Removed reference to Microsoft.Extensions.PlatformAbstractions --- Web/Managers/PasswordManager.cs | 1 - Web/Views/Shared/_FooterPartial.cshtml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Web/Managers/PasswordManager.cs b/Web/Managers/PasswordManager.cs index 582b55b..61b7cd7 100644 --- a/Web/Managers/PasswordManager.cs +++ b/Web/Managers/PasswordManager.cs @@ -6,7 +6,6 @@ using System.Security.Cryptography; using Microsoft.AspNetCore.Hosting; using QueryTree.Models; -using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; diff --git a/Web/Views/Shared/_FooterPartial.cshtml b/Web/Views/Shared/_FooterPartial.cshtml index 509cac9..8a7bf20 100644 --- a/Web/Views/Shared/_FooterPartial.cshtml +++ b/Web/Views/Shared/_FooterPartial.cshtml @@ -1,5 +1,5 @@ @{ - var version = Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion; + var version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version; }