vom laptop

This commit is contained in:
2022-12-05 19:04:39 +01:00
parent f3e85c3145
commit dfaa6f6c4c
22 changed files with 24354 additions and 21372 deletions

610
defs/IFlights.ts Normal file
View File

@ -0,0 +1,610 @@
// made with
// http://jvilk.com/MakeTypes/
export interface IFlights {
success: boolean;
message: string;
meta: Meta;
data?: (IFlight)[] | null;
}
export interface Meta {
totalCount: number;
}
export interface IFlight {
IDFlight: string;
FKGliderCategory: string;
Category: string;
FKCompetitionClass: string;
FKCompetitionClassDesired?: null;
CompetitionClass: string;
FKLaunchtype: string;
Launchtype: string;
FKPilot: string;
FirstName: string;
LastName: string;
Nationality: string;
FKFederation?: string | null;
ClubID?: string | null;
ClubName?: string | null;
Glider: string;
FKGlider?: string | null;
FKGliderBrand?: string | null;
GliderBrand?: string | null;
FKGliderClassification: string;
GliderClassification: string;
FKSeason: string;
FlightDate: string;
UtcOffset: string;
FlightStartTime: string;
FlightEndTime: string;
FlightDuration: string;
FirstLat: string;
FirstLng: string;
LastLat: string;
LastLng: string;
FlightMinLat: string;
FlightMaxLat: string;
FlightMinLng: string;
FlightMaxLng: string;
TakeoffCountry: string;
FKTakeoffWaypoint: string;
TakeoffWaypointOffset: string;
TakeoffLocation?: string | null;
TakeoffWaypointName: string;
FKClosestWaypoint?: string | null;
ClosestWaypointOffset?: string | null;
LandingCountry: string;
FKLandingWaypoint?: string | null;
LandingWaypointOffset?: string | null;
LandingWaypointName?: string | null;
LandingLocation?: string | null;
LinearDistance: string;
MaxLinearDistance: string;
ArcDistance?: string | null;
FKBestTaskType: string;
BestTaskType: string;
BestTaskTypeKey: string;
BestTaskDistance: string;
BestTaskPoints: string;
BestTaskDuration: string;
MaxSpeed?: string | null;
GroundSpeed?: string | null;
BestTaskSpeed: string;
TakeoffAltitude: string;
MaxAltitude: string;
MinAltitude: string;
ElevationGain?: string | null;
MeanAltitudeDiff: string;
MaxClimb: string;
MinClimb: string;
Dataversion: string;
ValidBRecordsCount?: string | null;
AirspaceViolationLevel?: string | null;
UserReviewComment: string;
UserReviewStatus: string;
ReviewRequired: string;
ReviewReason: string;
ReviewStatus: string;
ReviewComment: string;
ReviewBy: string;
ReviewTime?: null;
CommentsEnabled: string;
CountComments: string;
HasPhotos: string;
IsBigSmileCandidate: string;
WxcCivlID?: string | null;
WxcNacStatus?: string | null;
WxcSync?: string | null;
WxcSyncTS?: string | null;
IgcFilename: string;
IgcFileHash: string;
GRecordStatus: string;
GValidationMessage: string;
IsNew: string;
CanRetract: string;
StatisticsValid: string;
UC?: string | null;
TC: string;
US: string;
TS: string;
}
// Stores the currently-being-typechecked object for error messages.
let obj: any = null;
export class IFlightsProxy {
public readonly success: boolean;
public readonly message: string;
public readonly meta: MetaProxy;
public readonly data: IFlightProxy[] | null;
public static Parse(d: string): IFlightsProxy {
return IFlightsProxy.Create(JSON.parse(d));
}
public static Create(d: any, field: string = 'root'): IFlightsProxy {
if (!field) {
obj = d;
field = "root";
}
if (d === null || d === undefined) {
throwNull2NonNull(field, d);
} else if (typeof(d) !== 'object') {
throwNotObject(field, d, false);
} else if (Array.isArray(d)) {
throwIsArray(field, d, false);
}
checkBoolean(d.success, false, field + ".success");
checkString(d.message, false, field + ".message");
d.meta = MetaProxy.Create(d.meta, field + ".meta");
checkArray(d.data, field + ".data");
if (d.data) {
for (let i = 0; i < d.data.length; i++) {
d.data[i] = IFlightProxy.Create(d.data[i], field + ".data" + "[" + i + "]");
}
}
if (d.data === undefined) {
d.data = null;
}
return new IFlightsProxy(d);
}
private constructor(d: any) {
this.success = d.success;
this.message = d.message;
this.meta = d.meta;
this.data = d.data;
}
}
export class MetaProxy {
public readonly totalCount: number;
public static Parse(d: string): MetaProxy {
return MetaProxy.Create(JSON.parse(d));
}
public static Create(d: any, field: string = 'root'): MetaProxy {
if (!field) {
obj = d;
field = "root";
}
if (d === null || d === undefined) {
throwNull2NonNull(field, d);
} else if (typeof(d) !== 'object') {
throwNotObject(field, d, false);
} else if (Array.isArray(d)) {
throwIsArray(field, d, false);
}
checkNumber(d.totalCount, false, field + ".totalCount");
return new MetaProxy(d);
}
private constructor(d: any) {
this.totalCount = d.totalCount;
}
}
export class IFlightProxy {
public readonly IDFlight: string;
public readonly FKGliderCategory: string;
public readonly Category: string;
public readonly FKCompetitionClass: string;
public readonly FKCompetitionClassDesired: null;
public readonly CompetitionClass: string;
public readonly FKLaunchtype: string;
public readonly Launchtype: string;
public readonly FKPilot: string;
public readonly FirstName: string;
public readonly LastName: string;
public readonly Nationality: string;
public readonly FKFederation: string | null;
public readonly ClubID: string | null;
public readonly ClubName: string | null;
public readonly Glider: string;
public readonly FKGlider: string | null;
public readonly FKGliderBrand: string | null;
public readonly GliderBrand: string | null;
public readonly FKGliderClassification: string;
public readonly GliderClassification: string;
public readonly FKSeason: string;
public readonly FlightDate: string;
public readonly UtcOffset: string;
public readonly FlightStartTime: string;
public readonly FlightEndTime: string;
public readonly FlightDuration: string;
public readonly FirstLat: string;
public readonly FirstLng: string;
public readonly LastLat: string;
public readonly LastLng: string;
public readonly FlightMinLat: string;
public readonly FlightMaxLat: string;
public readonly FlightMinLng: string;
public readonly FlightMaxLng: string;
public readonly TakeoffCountry: string;
public readonly FKTakeoffWaypoint: string;
public readonly TakeoffWaypointOffset: string;
public readonly TakeoffLocation: string | null;
public readonly TakeoffWaypointName: string;
public readonly FKClosestWaypoint: string | null;
public readonly ClosestWaypointOffset: string | null;
public readonly LandingCountry: string;
public readonly FKLandingWaypoint: string | null;
public readonly LandingWaypointOffset: string | null;
public readonly LandingWaypointName: string | null;
public readonly LandingLocation: string | null;
public readonly LinearDistance: string;
public readonly MaxLinearDistance: string;
public readonly ArcDistance: string | null;
public readonly FKBestTaskType: string;
public readonly BestTaskType: string;
public readonly BestTaskTypeKey: string;
public readonly BestTaskDistance: string;
public readonly BestTaskPoints: string;
public readonly BestTaskDuration: string;
public readonly MaxSpeed: string | null;
public readonly GroundSpeed: string | null;
public readonly BestTaskSpeed: string;
public readonly TakeoffAltitude: string;
public readonly MaxAltitude: string;
public readonly MinAltitude: string;
public readonly ElevationGain: string | null;
public readonly MeanAltitudeDiff: string;
public readonly MaxClimb: string;
public readonly MinClimb: string;
public readonly Dataversion: string;
public readonly ValidBRecordsCount: string | null;
public readonly AirspaceViolationLevel: string | null;
public readonly UserReviewComment: string;
public readonly UserReviewStatus: string;
public readonly ReviewRequired: string;
public readonly ReviewReason: string;
public readonly ReviewStatus: string;
public readonly ReviewComment: string;
public readonly ReviewBy: string;
public readonly ReviewTime: null;
public readonly CommentsEnabled: string;
public readonly CountComments: string;
public readonly HasPhotos: string;
public readonly IsBigSmileCandidate: string;
public readonly WxcCivlID: string | null;
public readonly WxcNacStatus: string | null;
public readonly WxcSync: string | null;
public readonly WxcSyncTS: string | null;
public readonly IgcFilename: string;
public readonly IgcFileHash: string;
public readonly GRecordStatus: string;
public readonly GValidationMessage: string;
public readonly IsNew: string;
public readonly CanRetract: string;
public readonly StatisticsValid: string;
public readonly UC: string | null;
public readonly TC: string;
public readonly US: string;
public readonly TS: string;
public static Parse(d: string): IFlightProxy {
return IFlightProxy.Create(JSON.parse(d));
}
public static Create(d: any, field: string = 'root'): IFlightProxy {
if (!field) {
obj = d;
field = "root";
}
if (d === null || d === undefined) {
throwNull2NonNull(field, d);
} else if (typeof(d) !== 'object') {
throwNotObject(field, d, false);
} else if (Array.isArray(d)) {
throwIsArray(field, d, false);
}
checkString(d.IDFlight, false, field + ".IDFlight");
checkString(d.FKGliderCategory, false, field + ".FKGliderCategory");
checkString(d.Category, false, field + ".Category");
checkString(d.FKCompetitionClass, false, field + ".FKCompetitionClass");
checkNull(d.FKCompetitionClassDesired, field + ".FKCompetitionClassDesired");
if (d.FKCompetitionClassDesired === undefined) {
d.FKCompetitionClassDesired = null;
}
checkString(d.CompetitionClass, false, field + ".CompetitionClass");
checkString(d.FKLaunchtype, false, field + ".FKLaunchtype");
checkString(d.Launchtype, false, field + ".Launchtype");
checkString(d.FKPilot, false, field + ".FKPilot");
checkString(d.FirstName, false, field + ".FirstName");
checkString(d.LastName, false, field + ".LastName");
checkString(d.Nationality, false, field + ".Nationality");
checkString(d.FKFederation, true, field + ".FKFederation");
if (d.FKFederation === undefined) {
d.FKFederation = null;
}
checkString(d.ClubID, true, field + ".ClubID");
if (d.ClubID === undefined) {
d.ClubID = null;
}
checkString(d.ClubName, true, field + ".ClubName");
if (d.ClubName === undefined) {
d.ClubName = null;
}
checkString(d.Glider, false, field + ".Glider");
checkString(d.FKGlider, true, field + ".FKGlider");
if (d.FKGlider === undefined) {
d.FKGlider = null;
}
checkString(d.FKGliderBrand, true, field + ".FKGliderBrand");
if (d.FKGliderBrand === undefined) {
d.FKGliderBrand = null;
}
checkString(d.GliderBrand, true, field + ".GliderBrand");
if (d.GliderBrand === undefined) {
d.GliderBrand = null;
}
checkString(d.FKGliderClassification, false, field + ".FKGliderClassification");
checkString(d.GliderClassification, false, field + ".GliderClassification");
checkString(d.FKSeason, false, field + ".FKSeason");
checkString(d.FlightDate, false, field + ".FlightDate");
checkString(d.UtcOffset, false, field + ".UtcOffset");
checkString(d.FlightStartTime, false, field + ".FlightStartTime");
checkString(d.FlightEndTime, false, field + ".FlightEndTime");
checkString(d.FlightDuration, false, field + ".FlightDuration");
checkString(d.FirstLat, false, field + ".FirstLat");
checkString(d.FirstLng, false, field + ".FirstLng");
checkString(d.LastLat, false, field + ".LastLat");
checkString(d.LastLng, false, field + ".LastLng");
checkString(d.FlightMinLat, false, field + ".FlightMinLat");
checkString(d.FlightMaxLat, false, field + ".FlightMaxLat");
checkString(d.FlightMinLng, false, field + ".FlightMinLng");
checkString(d.FlightMaxLng, false, field + ".FlightMaxLng");
checkString(d.TakeoffCountry, false, field + ".TakeoffCountry");
checkString(d.FKTakeoffWaypoint, false, field + ".FKTakeoffWaypoint");
checkString(d.TakeoffWaypointOffset, false, field + ".TakeoffWaypointOffset");
checkString(d.TakeoffLocation, true, field + ".TakeoffLocation");
if (d.TakeoffLocation === undefined) {
d.TakeoffLocation = null;
}
checkString(d.TakeoffWaypointName, false, field + ".TakeoffWaypointName");
checkString(d.FKClosestWaypoint, true, field + ".FKClosestWaypoint");
if (d.FKClosestWaypoint === undefined) {
d.FKClosestWaypoint = null;
}
checkString(d.ClosestWaypointOffset, true, field + ".ClosestWaypointOffset");
if (d.ClosestWaypointOffset === undefined) {
d.ClosestWaypointOffset = null;
}
checkString(d.LandingCountry, false, field + ".LandingCountry");
checkString(d.FKLandingWaypoint, true, field + ".FKLandingWaypoint");
if (d.FKLandingWaypoint === undefined) {
d.FKLandingWaypoint = null;
}
checkString(d.LandingWaypointOffset, true, field + ".LandingWaypointOffset");
if (d.LandingWaypointOffset === undefined) {
d.LandingWaypointOffset = null;
}
checkString(d.LandingWaypointName, true, field + ".LandingWaypointName");
if (d.LandingWaypointName === undefined) {
d.LandingWaypointName = null;
}
checkString(d.LandingLocation, true, field + ".LandingLocation");
if (d.LandingLocation === undefined) {
d.LandingLocation = null;
}
checkString(d.LinearDistance, false, field + ".LinearDistance");
checkString(d.MaxLinearDistance, false, field + ".MaxLinearDistance");
checkString(d.ArcDistance, true, field + ".ArcDistance");
if (d.ArcDistance === undefined) {
d.ArcDistance = null;
}
checkString(d.FKBestTaskType, false, field + ".FKBestTaskType");
checkString(d.BestTaskType, false, field + ".BestTaskType");
checkString(d.BestTaskTypeKey, false, field + ".BestTaskTypeKey");
checkString(d.BestTaskDistance, false, field + ".BestTaskDistance");
checkString(d.BestTaskPoints, false, field + ".BestTaskPoints");
checkString(d.BestTaskDuration, false, field + ".BestTaskDuration");
checkString(d.MaxSpeed, true, field + ".MaxSpeed");
if (d.MaxSpeed === undefined) {
d.MaxSpeed = null;
}
checkString(d.GroundSpeed, true, field + ".GroundSpeed");
if (d.GroundSpeed === undefined) {
d.GroundSpeed = null;
}
checkString(d.BestTaskSpeed, false, field + ".BestTaskSpeed");
checkString(d.TakeoffAltitude, false, field + ".TakeoffAltitude");
checkString(d.MaxAltitude, false, field + ".MaxAltitude");
checkString(d.MinAltitude, false, field + ".MinAltitude");
checkString(d.ElevationGain, true, field + ".ElevationGain");
if (d.ElevationGain === undefined) {
d.ElevationGain = null;
}
checkString(d.MeanAltitudeDiff, false, field + ".MeanAltitudeDiff");
checkString(d.MaxClimb, false, field + ".MaxClimb");
checkString(d.MinClimb, false, field + ".MinClimb");
checkString(d.Dataversion, false, field + ".Dataversion");
checkString(d.ValidBRecordsCount, true, field + ".ValidBRecordsCount");
if (d.ValidBRecordsCount === undefined) {
d.ValidBRecordsCount = null;
}
checkString(d.AirspaceViolationLevel, true, field + ".AirspaceViolationLevel");
if (d.AirspaceViolationLevel === undefined) {
d.AirspaceViolationLevel = null;
}
checkString(d.UserReviewComment, false, field + ".UserReviewComment");
checkString(d.UserReviewStatus, false, field + ".UserReviewStatus");
checkString(d.ReviewRequired, false, field + ".ReviewRequired");
checkString(d.ReviewReason, false, field + ".ReviewReason");
checkString(d.ReviewStatus, false, field + ".ReviewStatus");
checkString(d.ReviewComment, false, field + ".ReviewComment");
checkString(d.ReviewBy, false, field + ".ReviewBy");
checkNull(d.ReviewTime, field + ".ReviewTime");
if (d.ReviewTime === undefined) {
d.ReviewTime = null;
}
checkString(d.CommentsEnabled, false, field + ".CommentsEnabled");
checkString(d.CountComments, false, field + ".CountComments");
checkString(d.HasPhotos, false, field + ".HasPhotos");
checkString(d.IsBigSmileCandidate, false, field + ".IsBigSmileCandidate");
checkString(d.WxcCivlID, true, field + ".WxcCivlID");
if (d.WxcCivlID === undefined) {
d.WxcCivlID = null;
}
checkString(d.WxcNacStatus, true, field + ".WxcNacStatus");
if (d.WxcNacStatus === undefined) {
d.WxcNacStatus = null;
}
checkString(d.WxcSync, true, field + ".WxcSync");
if (d.WxcSync === undefined) {
d.WxcSync = null;
}
checkString(d.WxcSyncTS, true, field + ".WxcSyncTS");
if (d.WxcSyncTS === undefined) {
d.WxcSyncTS = null;
}
checkString(d.IgcFilename, false, field + ".IgcFilename");
checkString(d.IgcFileHash, false, field + ".IgcFileHash");
checkString(d.GRecordStatus, false, field + ".GRecordStatus");
checkString(d.GValidationMessage, false, field + ".GValidationMessage");
checkString(d.IsNew, false, field + ".IsNew");
checkString(d.CanRetract, false, field + ".CanRetract");
checkString(d.StatisticsValid, false, field + ".StatisticsValid");
checkString(d.UC, true, field + ".UC");
if (d.UC === undefined) {
d.UC = null;
}
checkString(d.TC, false, field + ".TC");
checkString(d.US, false, field + ".US");
checkString(d.TS, false, field + ".TS");
return new IFlightProxy(d);
}
private constructor(d: any) {
this.IDFlight = d.IDFlight;
this.FKGliderCategory = d.FKGliderCategory;
this.Category = d.Category;
this.FKCompetitionClass = d.FKCompetitionClass;
this.FKCompetitionClassDesired = d.FKCompetitionClassDesired;
this.CompetitionClass = d.CompetitionClass;
this.FKLaunchtype = d.FKLaunchtype;
this.Launchtype = d.Launchtype;
this.FKPilot = d.FKPilot;
this.FirstName = d.FirstName;
this.LastName = d.LastName;
this.Nationality = d.Nationality;
this.FKFederation = d.FKFederation;
this.ClubID = d.ClubID;
this.ClubName = d.ClubName;
this.Glider = d.Glider;
this.FKGlider = d.FKGlider;
this.FKGliderBrand = d.FKGliderBrand;
this.GliderBrand = d.GliderBrand;
this.FKGliderClassification = d.FKGliderClassification;
this.GliderClassification = d.GliderClassification;
this.FKSeason = d.FKSeason;
this.FlightDate = d.FlightDate;
this.UtcOffset = d.UtcOffset;
this.FlightStartTime = d.FlightStartTime;
this.FlightEndTime = d.FlightEndTime;
this.FlightDuration = d.FlightDuration;
this.FirstLat = d.FirstLat;
this.FirstLng = d.FirstLng;
this.LastLat = d.LastLat;
this.LastLng = d.LastLng;
this.FlightMinLat = d.FlightMinLat;
this.FlightMaxLat = d.FlightMaxLat;
this.FlightMinLng = d.FlightMinLng;
this.FlightMaxLng = d.FlightMaxLng;
this.TakeoffCountry = d.TakeoffCountry;
this.FKTakeoffWaypoint = d.FKTakeoffWaypoint;
this.TakeoffWaypointOffset = d.TakeoffWaypointOffset;
this.TakeoffLocation = d.TakeoffLocation;
this.TakeoffWaypointName = d.TakeoffWaypointName;
this.FKClosestWaypoint = d.FKClosestWaypoint;
this.ClosestWaypointOffset = d.ClosestWaypointOffset;
this.LandingCountry = d.LandingCountry;
this.FKLandingWaypoint = d.FKLandingWaypoint;
this.LandingWaypointOffset = d.LandingWaypointOffset;
this.LandingWaypointName = d.LandingWaypointName;
this.LandingLocation = d.LandingLocation;
this.LinearDistance = d.LinearDistance;
this.MaxLinearDistance = d.MaxLinearDistance;
this.ArcDistance = d.ArcDistance;
this.FKBestTaskType = d.FKBestTaskType;
this.BestTaskType = d.BestTaskType;
this.BestTaskTypeKey = d.BestTaskTypeKey;
this.BestTaskDistance = d.BestTaskDistance;
this.BestTaskPoints = d.BestTaskPoints;
this.BestTaskDuration = d.BestTaskDuration;
this.MaxSpeed = d.MaxSpeed;
this.GroundSpeed = d.GroundSpeed;
this.BestTaskSpeed = d.BestTaskSpeed;
this.TakeoffAltitude = d.TakeoffAltitude;
this.MaxAltitude = d.MaxAltitude;
this.MinAltitude = d.MinAltitude;
this.ElevationGain = d.ElevationGain;
this.MeanAltitudeDiff = d.MeanAltitudeDiff;
this.MaxClimb = d.MaxClimb;
this.MinClimb = d.MinClimb;
this.Dataversion = d.Dataversion;
this.ValidBRecordsCount = d.ValidBRecordsCount;
this.AirspaceViolationLevel = d.AirspaceViolationLevel;
this.UserReviewComment = d.UserReviewComment;
this.UserReviewStatus = d.UserReviewStatus;
this.ReviewRequired = d.ReviewRequired;
this.ReviewReason = d.ReviewReason;
this.ReviewStatus = d.ReviewStatus;
this.ReviewComment = d.ReviewComment;
this.ReviewBy = d.ReviewBy;
this.ReviewTime = d.ReviewTime;
this.CommentsEnabled = d.CommentsEnabled;
this.CountComments = d.CountComments;
this.HasPhotos = d.HasPhotos;
this.IsBigSmileCandidate = d.IsBigSmileCandidate;
this.WxcCivlID = d.WxcCivlID;
this.WxcNacStatus = d.WxcNacStatus;
this.WxcSync = d.WxcSync;
this.WxcSyncTS = d.WxcSyncTS;
this.IgcFilename = d.IgcFilename;
this.IgcFileHash = d.IgcFileHash;
this.GRecordStatus = d.GRecordStatus;
this.GValidationMessage = d.GValidationMessage;
this.IsNew = d.IsNew;
this.CanRetract = d.CanRetract;
this.StatisticsValid = d.StatisticsValid;
this.UC = d.UC;
this.TC = d.TC;
this.US = d.US;
this.TS = d.TS;
}
}
function throwNull2NonNull(field: string, d: any): never {
return errorHelper(field, d, "non-nullable object", false);
}
function throwNotObject(field: string, d: any, nullable: boolean): never {
return errorHelper(field, d, "object", nullable);
}
function throwIsArray(field: string, d: any, nullable: boolean): never {
return errorHelper(field, d, "object", nullable);
}
function checkArray(d: any, field: string): void {
if (!Array.isArray(d) && d !== null && d !== undefined) {
errorHelper(field, d, "array", true);
}
}
function checkNumber(d: any, nullable: boolean, field: string): void {
if (typeof(d) !== 'number' && (!nullable || (nullable && d !== null && d !== undefined))) {
errorHelper(field, d, "number", nullable);
}
}
function checkBoolean(d: any, nullable: boolean, field: string): void {
if (typeof(d) !== 'boolean' && (!nullable || (nullable && d !== null && d !== undefined))) {
errorHelper(field, d, "boolean", nullable);
}
}
function checkString(d: any, nullable: boolean, field: string): void {
if (typeof(d) !== 'string' && (!nullable || (nullable && d !== null && d !== undefined))) {
errorHelper(field, d, "string", nullable);
}
}
function checkNull(d: any, field: string): void {
if (d !== null && d !== undefined) {
errorHelper(field, d, "null or undefined", false);
}
}
function errorHelper(field: string, d: any, type: string, nullable: boolean): never {
if (nullable) {
type += ", null, or undefined";
}
throw new TypeError('Expected ' + type + " at " + field + " but found:\n" + JSON.stringify(d) + "\n\nFull object:\n" + JSON.stringify(obj));
}

10
docs/GetHoPeAll.json Normal file → Executable file
View File

@ -1,6 +1,6 @@
[ [
{ {
"name" : "HoPe_all_flights", "name" : "HoPe_all_flights",
"url" : "https://de.dhv-xc.de/api/fli/flights?fkpil%5B%5D=1295&l-fkpil%5B%5D=Hoppe%2C%20Peter&navpars=%7B%22start%22%3A0%2C%22limit%22%3A2000%2C%22sort%22%3A%5B%7B%22field%22%3A%22FlightDate%22%2C%22dir%22%3A-1%7D%2C%7B%22field%22%3A%22BestTaskPoints%22%2C%22dir%22%3A-1%7D%5D%7D" "url" : "https://de.dhv-xc.de/api/fli/flights?fkpil%5B%5D=1295&l-fkpil%5B%5D=Hoppe%2C%20Peter&navpars=%7B%22start%22%3A0%2C%22limit%22%3A2000%2C%22sort%22%3A%5B%7B%22field%22%3A%22FlightDate%22%2C%22dir%22%3A-1%7D%2C%7B%22field%22%3A%22BestTaskPoints%22%2C%22dir%22%3A-1%7D%5D%7D"
} }
] ]

0
docs/HoPe_all_flights.json Normal file → Executable file
View File

36548
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,9 +10,11 @@
"@types/node": "^16.18.4", "@types/node": "^16.18.4",
"@types/react": "^18.0.25", "@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9", "@types/react-dom": "^18.0.9",
"natural-orderby": "^3.0.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-scripts": "^2.1.3", "react-scripts": "^5.0.1",
"react-table": "^7.8.0",
"typescript": "^4.9.3", "typescript": "^4.9.3",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
@ -39,5 +41,8 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
},
"devDependencies": {
"@types/react-table": "^7.7.12"
} }
} }

View File

@ -22,7 +22,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>PHP XC Stat</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1,6 +1,6 @@
{ {
"short_name": "React App", "short_name": "PHP XC Stats",
"name": "Create React App Sample", "name": "PHP login protected XC Statistics",
"start_url": ".", "start_url": ".",
"display": "standalone", "display": "standalone",
"theme_color": "#000000", "theme_color": "#000000",

View File

@ -36,3 +36,98 @@
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
.sort-button {
background-color: transparent;
border: none;
padding: 5px 10px;
margin: 0;
line-height: 1;
font-size: 15px;
color: black;
cursor: pointer;
transition: transform 0.05s ease-out;
}
.sort-reverse {
transform: rotate(180deg);
}
table,
th,
td {
border: thin solid;
}
table{
margin: 0 auto;
}
/* Sortable tables */
table.sortable thead {
background-color:rgb(171, 71, 13);
color:#144514;
font-weight: bold;
cursor: default;
}
body{
background-color: rgba(243, 97, 12, 0.31);
}
table,
th,
td
{
background-color: rgba(243, 97, 12, 0.836);
border: 1px solid rgba(0, 0, 0, 0.8);
padding: 5px;
font-size: 1em;
text-align: center;
white-space: nowrap;
}
h1,h2,h4,p
{
text-align: center;
}
.toindex
{
text-align: left;
}
.flexbox
{
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
.right
{
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-end;
}
.header
{
border: 0px;
font-weight: 900;
font-size: 2em;
}
.pilot .header
{
font-weight: bold;
}
.link
{
font-size: 80%;
}

View File

@ -1,24 +1,27 @@
import React from 'react'; import React from "react";
import './App.css'; import "./App.css";
import FlightsTable from "./components/FlightsTable";
import SeasonTable from "./components/SeasonTable";
import {groupByMap} from './global/tools';
import flights from './data/HoPe_all_flights.json';
import {IFlight} from './interfaces/IFlights';
import {CSeason} from './classes/CSeason';
function App() { const data = flights.data;
return ( const seasondataraw = groupByMap(data, i => i.FKSeason);
<div className="App"> const seasondata: CSeason[] = [];
<header className="App-header">
<p> for (let [key, value] of seasondataraw)
Edit <code>src/App.tsx</code> and save to reload. {
</p> seasondata.push(new CSeason(key, value));
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React XXXX
</a>
</header>
</div>
);
} }
export default App; export default function App()
{
return(
<div className='App'>
{/* <SeasonTable seasondata = {seasondata} /> */}
<FlightsTable flightdata = {data}/>
</div>
);
}

28
src/classes/CHour.ts Normal file
View File

@ -0,0 +1,28 @@
export class CHour
{
public minutes_sum: number;
private _hours: number;
private _minutes: number;
constructor(secs: number)
{
this.minutes_sum = Math.round(secs / 60);
this._hours = Math.floor(this.minutes_sum / 60);
this._minutes = this.minutes_sum % 60;
}
Add(hour: CHour)
{
this.minutes_sum += hour.minutes_sum;
this._hours = Math.floor(this.minutes_sum / 60);
this._minutes = this.minutes_sum % 60;
}
Print()
{
// const nbspc = String.fromCharCode(160);
// return (nbspc + nbspc + nbspc + this._hours).slice(-4) + ":" + ("0" + this._minutes).slice(-2);
return this._hours + ":" +
("0" + this._minutes).slice(-2);
}
};

31
src/classes/CSeason.ts Normal file
View File

@ -0,0 +1,31 @@
import {IFlight} from '../interfaces/IFlights';
import {CHour} from '../classes/CHour';
export class CSeason
{
id: string;
flighttime: CHour;
flights: IFlight[];
constructor(id: string, flights: IFlight[])
{
this.id = id;
this.flights = flights;
this.flighttime = new CHour(0)
this.calcFlighttime();
}
calcFlighttime()
{
for (let f of this.flights)
{
const ftime: number = +f.FlightDuration;
this.flighttime.Add(new CHour(ftime));
}
}
get flightCount() : number
{
return this.flights.length;
}
}

View File

@ -0,0 +1,42 @@
import React from "react";
import SortableTable from "./SortableTable";
import {THeader} from "./SortableTable";
import {IFlight} from '../interfaces/IFlights';
function Link2Flight(key: string, row: any, data: string | null)
{
var val: JSX.Element = <></>;
const link: string = 'https://de.dhv-xc.de/flight/' + row['IDFlight'];
val = <td><a href={link} target="_blank" rel="noopener noreferrer" >{data}</a></td>;
return val;
}
function Meter2Km(key: string, row: any, data: string | null)
{
var val: JSX.Element = <></>;
const numdata: number = +data! / 1000;
val = <td>{numdata}</td>;
return val;
}
export default function FlightsTable(flightdata: IFlight[])
//export default function FlightsTable(flightdata: any)
{
const headers: THeader[] = [
{ key: "IDFlight", label: "ID", visible: false },
{ key: "FlightDate", label: "Datum", callback: Link2Flight },
{ key: "TakeoffWaypointName", label: "Start" },
{ key: "Glider", label: "Gleitschirm" },
{ key: "BestTaskDistance", label: "Strecke", callback: Meter2Km },
{ key: "BestTaskType", label: "Streckentyp" },
{ key: "BestTaskPoints", label: "Punkte" }
];
return(
<div className='App'>
<SortableTable<IFlight> headers={headers} dataTbl={flightdata} ></SortableTable>
</div>
);
}

View File

@ -0,0 +1,9 @@
import React from "react";
import {CSeason} from '../classes/CSeason';
//export default function SeasonTable(seasondata: CSeason[])
export default function SeasonTable(seasondata: CSeason[])
{
return (<></>);
}

View File

@ -0,0 +1,157 @@
import React from "react";
import { orderBy } from 'natural-orderby';
import { MouseEventHandler, useState } from "react";
export interface ITableTdCallback {(key: string, row: any, data: string | null): JSX.Element};
export type THeader = { key: string; label: string; visible?: boolean; callback?: ITableTdCallback };
type TSortOrder = "ascn" | "desc";
function SortButton({
sortOrder,
columnKey,
sortKey,
onClick,
}: {
sortOrder: TSortOrder;
columnKey: string;
sortKey: string;
onClick: MouseEventHandler<HTMLButtonElement>;
}) {
return (
<button
onClick={onClick}
className={`${
sortKey === columnKey && sortOrder === "desc"
? "sort-button sort-reverse"
: "sort-button"
}`}
>
</button>
);
}
export default function SortableTable<T>({ headers, dataTbl }:
{ headers: THeader[], dataTbl: T[]})
{
const [sortKey, setSortKey] = useState<string>(headers[0].key);
const [sortOrder, setSortOrder] = useState<TSortOrder>("ascn");
const sortedData: T[] = sortData(
{
tableData: dataTbl,
sortKey: sortKey,
reverse: sortOrder === "desc"
});
function changeSort(key: string) {
setSortOrder(sortOrder === "ascn" ? "desc" : "ascn");
setSortKey(key);
}
function sortData({
tableData,
sortKey,
reverse,
}: {
tableData: T[];
sortKey: string;
reverse: boolean;
})
{
if (!sortKey) return tableData;
const order = reverse ? 'asc': 'desc';
// const reval: T[] = orderBy(tableData, [sortKey], [order]);
const reval: T[] = tableData;
return reval;
}
function TableTd({ item, row_item, data } : {item: THeader, row_item: T, data: string | null})
{
var val_complete: JSX.Element = <></>;
if(item.visible === undefined || item.visible === true)
{
if(item.callback)
{
val_complete = item.callback(item.key, row_item, data);
}
else
{
val_complete = (<td>{data}</td>);
}
}
return val_complete;
}
function TableTr(
{headers,row_item}:
{
headers: THeader[],
row_item: T
})
{
return(
<tr>
{
headers.map((h_item) =>
{
var c: any = row_item; // workaround TS2322 TS7053
return ( <TableTd item={h_item} row_item={row_item} data={c[h_item.key]}></TableTd> );
})}
</tr>
);
}
function tableHeader(headers: THeader[])
{
return(
headers.map(
(row) =>
{
if(row.visible === undefined || row.visible === true)
{
return (
<td key={row.key}>
{row.label}{" "}
<SortButton
columnKey={row.key}
onClick={() => changeSort(row.key)}
{...{
sortOrder,
sortKey,
}}
/>
</td>
);
}
else
{
return (<></>);
}
}
));
}
return (
<table className='sortable'>
<thead>
<tr>
{tableHeader(headers)}
</tr>
</thead>
<tbody>
{sortedData.map((row_item) => {
return (
<TableTr headers={headers} row_item = {row_item} />
);
})}
</tbody>
</table>
);
}

1
src/data/HoPe_all_flights.json Executable file

File diff suppressed because one or more lines are too long

8002
src/data/dataX.json Normal file

File diff suppressed because it is too large Load Diff

21
src/global/tools.ts Normal file
View File

@ -0,0 +1,21 @@
export const groupBy = <T, K extends keyof any>(arr: T[], key: (i: T) => K) =>
arr.reduce((groups, item) =>
{
(groups[key(item)] ||= []).push(item);
return groups;
}, {} as Record<K, T[]>);
export function groupByMap<K, V>(list: Array<V>, keyGetter: (input: V) => K): Map<K, Array<V>>
{
const map = new Map<K, Array<V>>();
list.forEach((item) => {
const key = keyGetter(item);
const collection = map.get(key);
if (!collection) {
map.set(key, [item]);
} else {
collection.push(item);
}
});
return map;
}

107
src/interfaces/IFlights.ts Normal file
View File

@ -0,0 +1,107 @@
export interface IFlights {
success: boolean;
message: string;
meta: Meta;
data?: (IFlight)[] | null;
}
export interface Meta {
totalCount: number;
}
export interface IFlight {
IDFlight: string;
FKGliderCategory: string;
Category: string;
FKCompetitionClass: string;
FKCompetitionClassDesired?: null;
CompetitionClass: string;
FKLaunchtype: string;
Launchtype: string;
FKPilot: string;
FirstName: string;
LastName: string;
Nationality: string;
FKFederation?: string | null;
ClubID?: string | null;
ClubName?: string | null;
Glider: string;
FKGlider?: string | null;
FKGliderBrand?: string | null;
GliderBrand?: string | null;
FKGliderClassification: string;
GliderClassification: string;
FKSeason: string;
FlightDate: string;
UtcOffset: string;
FlightStartTime: string;
FlightEndTime: string;
FlightDuration: string;
FirstLat: string;
FirstLng: string;
LastLat: string;
LastLng: string;
FlightMinLat: string;
FlightMaxLat: string;
FlightMinLng: string;
FlightMaxLng: string;
TakeoffCountry: string;
FKTakeoffWaypoint: string;
TakeoffWaypointOffset: string;
TakeoffLocation?: string | null;
TakeoffWaypointName: string;
FKClosestWaypoint?: string | null;
ClosestWaypointOffset?: string | null;
LandingCountry: string;
FKLandingWaypoint?: string | null;
LandingWaypointOffset?: string | null;
LandingWaypointName?: string | null;
LandingLocation?: string | null;
LinearDistance: string;
MaxLinearDistance: string;
ArcDistance?: string | null;
FKBestTaskType: string;
BestTaskType: string;
BestTaskTypeKey: string;
BestTaskDistance: string;
BestTaskPoints: string;
BestTaskDuration: string;
MaxSpeed?: string | null;
GroundSpeed?: string | null;
BestTaskSpeed: string;
TakeoffAltitude: string;
MaxAltitude: string;
MinAltitude: string;
ElevationGain?: string | null;
MeanAltitudeDiff: string;
MaxClimb: string;
MinClimb: string;
Dataversion: string;
ValidBRecordsCount?: string | null;
AirspaceViolationLevel?: string | null;
UserReviewComment: string;
UserReviewStatus: string;
ReviewRequired: string;
ReviewReason: string;
ReviewStatus: string;
ReviewComment: string;
ReviewBy: string;
ReviewTime?: null;
CommentsEnabled: string;
CountComments: string;
HasPhotos: string;
IsBigSmileCandidate: string;
WxcCivlID?: string | null;
WxcNacStatus?: string | null;
WxcSync?: string | null;
WxcSyncTS?: string | null;
IgcFilename: string;
IgcFileHash: string;
GRecordStatus: string;
GValidationMessage: string;
IsNew: string;
CanRetract: string;
StatisticsValid: string;
UC?: string | null;
TC: string;
US: string;
TS: string;
}

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es7",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -21,6 +21,7 @@
"jsx": "preserve" "jsx": "preserve"
}, },
"include": [ "include": [
"src" "src",
"defs/IFlights.ts"
] ]
} }

2
www/geheim.php Normal file → Executable file
View File

@ -8,5 +8,5 @@ if(!isset($_SESSION['userid']))
//Abfrage der Nutzer ID vom Login //Abfrage der Nutzer ID vom Login
$userid = $_SESSION['userid']; $userid = $_SESSION['userid'];
echo "Hallo UserXX: ".$userid; echo "Hallo User: ".$userid;
?> ?>

0
www/login.php Normal file → Executable file
View File

0
www/registrieren.php Normal file → Executable file
View File