Compare commits

..

No commits in common. "main" and "v0.3.3" have entirely different histories.
main ... v0.3.3

5 changed files with 14 additions and 33 deletions

View File

@ -46,7 +46,7 @@ namespace dopt.DeltaBarth.Tests
Assert.AreEqual(102, parsed.code);
Assert.IsTrue(parsed.description.Contains("internal error occurred"));
Assert.AreEqual("caused by test", parsed.message);
Assert.IsNull(parsed.api_server_error);
Assert.IsNull(parsed.apiServerError);
PrettyPrint(parsed);
plugin.Dispose();
}
@ -151,7 +151,7 @@ namespace dopt.DeltaBarth.Tests
Assert.AreEqual(0, parsed.status.code);
Assert.AreEqual("Erfolg", parsed.status.description);
Assert.AreEqual("", parsed.status.message);
Assert.IsNull(parsed.status.api_server_error);
Assert.IsNull(parsed.status.apiServerError);
// check result
for (int i = 0; i < parsed.response.daten.Length; i++)
{

View File

@ -173,31 +173,16 @@ namespace dopt.DeltaBarth.Tests
}
[TestMethod]
[TestCategory("ActiveAPI")]
public void Umsatzprognose_WithCompanyIdWithDate_Test()
{
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
var date = new DateTime(2023, 8, 15, 12, 45, 30);
List<int> comp_id = new List<int> { 1027, 5661, 1024 };
var res = test.Umsatzprognose(comp_id, date);
PrettyPrint(res);
Assert.AreEqual(4, res.status.code);
Assert.AreEqual((int)StatusCodes.DatensatzZuWenigeMonatsdatenpunkte, res.status.code);
test.Dispose();
}
[TestMethod]
[TestCategory("ActiveAPI")]
public void Umsatzprognose_WithCompanyIdWithoutDate_Test()
{
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
List<int> comp_id = new List<int> { 5661 };
var comp_id = 1024;
var res = test.Umsatzprognose(comp_id, null);
PrettyPrint(res);
Assert.AreEqual(4, res.status.code);
Assert.AreEqual((int)StatusCodes.DatensatzZuWenigeMonatsdatenpunkte, res.status.code);
Assert.AreEqual(0, res.status.code);
Assert.AreEqual((int)StatusCodes.Erfolg, res.status.code);
test.Dispose();
}
[TestMethod]
@ -206,7 +191,7 @@ namespace dopt.DeltaBarth.Tests
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
List<int> comp_id = new List<int> { 5661 };
var comp_id = 1024;
var res = test.Umsatzprognose(comp_id, null);
PrettyPrint(res);
Assert.AreEqual(1, res.status.code);
@ -247,7 +232,7 @@ namespace dopt.DeltaBarth.Tests
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
var date = new DateTime(2021, 1, 1, 12, 45, 30);
var date = new DateTime(2015, 1, 1, 12, 45, 30);
var res = test.Umsatzprognose(null, date);
PrettyPrint(res);
Assert.AreEqual(0, res.status.code);

View File

@ -37,10 +37,6 @@ namespace dopt.DeltaBarth.DataObjects
/// </summary>
public string? title { get; init; }
/// <summary>
/// optional: zusätzliche Fehlerdetails, die vom Server ausgegeben wurden
/// </summary>
public Dictionary<string, List<string>>? errors { get; init; }
/// <summary>
/// optional: spezifischer ID (vermutlich zur Nachverfolgung) als Text, der vom Server ausgegeben wurde
/// </summary>
public string? traceId { get; init; }
@ -66,7 +62,7 @@ namespace dopt.DeltaBarth.DataObjects
/// <summary cref="ApiServerError">
/// optional: eventuell aufgetretener API-Server-Fehler
/// </summary>
public ApiServerError? api_server_error { get; init; }
public ApiServerError? apiServerError { get; init; }
}
/// <summary>

View File

@ -93,7 +93,7 @@ namespace dopt.DeltaBarth
/// </summary>
/// <param name="runtimePath">Der Pfad zur Python-Runtime. Dieser muss zu dem Ordner zeigen,
/// in welchem die Runtime in Form eines Ordners mit dem Namen "python" abliegt.</param>
public Plugin(string runtimePath) : base(SharpPython.PyOptimLevels.O, threaded: true, runtimePath: runtimePath, verbose: false)
public Plugin(string runtimePath) : base(SharpPython.PyOptimLevels.O, runtimePath: runtimePath, verbose: false)
{
base.Initialise();
using (Py.GIL())
@ -160,20 +160,20 @@ namespace dopt.DeltaBarth
/// Es werden API-Abrufe durchgeführt und somit auch Live-Daten genutzt.
/// Hierfür muss sichergestellt sein, dass der API-Server erreichbar und abrufbereit ist.
/// </summary>
/// <param name="firmaIds">optional: Liste von Firmen-IDs, für die die Pipeline ausgeführt werden soll.
/// <param name="firmaId">optional: Firmen-ID, für die die Pipeline ausgeführt werden soll.
/// Wird der Parameter nicht zur Verfügung gestellt, werden alle Firmen bzw. Kunden abgerufen</param>
/// <param name="analyseBeginn">optional: Start-Datum, ab dem die Daten für die Erstellung des Prognosemodells genutzt werden.
/// Daten, die weiter in der Vergangenheit liegen, werden nicht berücksichtigt.
/// Wird der Parameter nicht zur Verfügung gestellt, wird die gesamte Historie genutzt.</param>
/// <returns cref="DataObjects.UmsatzPrognoseAusgabe">Umsatzprognose inkl. Status-Objekt zur Nachvollziehbarkeit etwaig aufgetretener Fehler.</returns>
/// <exception cref="PythonParsingException"></exception>
public DataObjects.UmsatzPrognoseAusgabe Umsatzprognose(List<int>? firmaIds, DateTime? analyseBeginn)
public DataObjects.UmsatzPrognoseAusgabe Umsatzprognose(int? firmaId, DateTime? analyseBeginn)
{
AssertNotDisposed();
string pyJson;
using (Py.GIL())
{
pyJson = pyModPipeline.pipeline_sales_forecast(firmaIds, analyseBeginn);
pyJson = pyModPipeline.pipeline_sales_forecast(firmaId, analyseBeginn);
}
var parsed = JsonSerializer.Deserialize<DataObjects.UmsatzPrognoseAusgabe>(pyJson) ?? throw new PythonParsingException("Could not correctly parse object from Python");
return parsed;

View File

@ -6,12 +6,12 @@
<Nullable>enable</Nullable>
<PlatformTarget>x64</PlatformTarget>
<Platforms>x64</Platforms>
<Version>0.4.1</Version>
<Version>0.3.3</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="dopt.SharpPython" Version="0.4.4" />
<PackageReference Include="dopt.SharpPython" Version="0.4.1" />
</ItemGroup>
</Project>