diff --git a/.gitignore b/.gitignore index 6f8b91ddd0667aac76bdafa7f7f54b16673e914f..679caebd37607c70743aec43d2f3c506ba78bcb6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ src/ClientServer/wwwroot/* !src/ClientServer/wwwroot/.gitkeep src/ClientServer/output src/ClientServer/wwwUploaded_Files/* +src/ClientServer/appsettings.json diff --git a/src/ClientServer/Config/Constants.cs b/src/ClientServer/Config/Constants.cs index bbf291598bdb22b0f01f377d66b9f662d3479ff8..71fa0dceb909a299ed3aeb6166501223003f130a 100644 --- a/src/ClientServer/Config/Constants.cs +++ b/src/ClientServer/Config/Constants.cs @@ -13,7 +13,7 @@ namespace ClientServer.Helpers /// </summary> public static class Constants { - public static string VersionString = "2.5.5"; + public static string VersionString = "2.5.6"; /// <summary> /// this is only set once at program.cs!! diff --git a/src/ClientServer/Controllers/Core/Exercises/ExerciseEditorController.cs b/src/ClientServer/Controllers/Core/Exercises/ExerciseEditorController.cs index ea8f588690b3ce4b04a4cf60b8f9aa9e450280d8..18713a123e6a17a63baf1e74fcaff8a3d1ac21b5 100644 --- a/src/ClientServer/Controllers/Core/Exercises/ExerciseEditorController.cs +++ b/src/ClientServer/Controllers/Core/Exercises/ExerciseEditorController.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ClientServer.Models.Exercises.Solution; using ClientServer.Models.Files; +using Newtonsoft.Json; namespace ClientServer.Controllers.Core.Exercises { @@ -1657,6 +1658,8 @@ namespace ClientServer.Controllers.Core.Exercises }, }; + string jsonTests = ""; + string jsonTests2 = ""; try { @@ -1679,6 +1682,10 @@ namespace ClientServer.Controllers.Core.Exercises try { _context.Exercises.Add(exCopy); + + jsonTests = JsonConvert.SerializeObject(exCopy.Tests, Formatting.Indented, + new JsonSerializerSettings() {ReferenceLoopHandling = ReferenceLoopHandling.Serialize}); + await _context.SaveChangesAsync(); //now set main files... @@ -1709,6 +1716,11 @@ namespace ClientServer.Controllers.Core.Exercises } catch (Exception e) { + + //we get the error here: ERROR: insert or update on table "TestCaseSettingses" violates foreign key constraint "FK_TestCaseSettingses_Tests_TestId + //DETAIL: Key (TestId)=(0) is not present in table "Tests". + Console.WriteLine("DBG: " + jsonTests); + //see https://www.npgsql.org/doc/transactions.html await base.HandleDbError(e); return; diff --git a/src/ClientServer/appsettings.json b/src/ClientServer/appsettings_example.json similarity index 68% rename from src/ClientServer/appsettings.json rename to src/ClientServer/appsettings_example.json index 9d2da60c119a5cb09a59ec3d990132bce3bffab9..003c88244a9a046309cbec4b99fe0a7207011d51 100644 --- a/src/ClientServer/appsettings.json +++ b/src/ClientServer/appsettings_example.json @@ -10,15 +10,15 @@ "IsDebugMode": true, "IsDbBootstrapEnabled": false, - "DbConnectionString": "Username=postgres;Password=janis;Host=localhost;Database=yapexDb;Pooling=true", + "DbConnectionString": "Username=XXX;Password=YYY;Host=localhost;Database=yapexDb;Pooling=true", "SystemSalt": "NeverChangeThisAfterFirstStartup", - "ExternalLoginUrl": "https://uebungsportal.informatik.uni-halle.de/ostepu/DB/DBTransaction/transaction/authentication/redirect/transaction/", + "ExternalLoginUrl": "URL", "MainEntrySite": "/", "LoginExternalFirstTimeSite": "/firstLoginExternalLogin.html", "RunAssessmentsAsync": false, "DashboardScriptPathRelativeToCurrentDir": "dashboard.php", "DebugOriginUrl": "http://localhost:8080", - "DeployOriginUrls": ["https://yapex.informatik.uni-halle.de"], + "DeployOriginUrls": ["DEPLOY URL"], "IsSlave": false, "EnsureFileUploadDirStructure": true, "OnlySecureFlaggedCookies": false,