Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change day_of_month to just day #190

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions lib/plugins/Label_13Through18_Slash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Label_13Through18_Slash', () => {
expect(decodeResult.decoded).toBe(true);

expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('Out of Gate Report');
expect(decodeResult.formatted.items.length).toBe(3);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -46,7 +46,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('Out of Gate Report');
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -67,7 +67,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.day_of_month).toBe(8);
expect(decodeResult.raw.day).toBe(8);
expect(decodeResult.formatted.description).toBe('Takeoff Report');
expect(decodeResult.formatted.items.length).toBe(3);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -85,7 +85,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.day_of_month).toBe(9);
expect(decodeResult.raw.day).toBe(9);
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
expect(decodeResult.formatted.items[0].value).toBe('KIAD');
Expand All @@ -105,7 +105,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(9);
expect(decodeResult.raw.day).toBe(9);
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
expect(decodeResult.formatted.items[0].value).toBe('KIAD');
Expand All @@ -131,7 +131,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(10);
expect(decodeResult.raw.day).toBe(10);
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
expect(decodeResult.formatted.items[0].value).toBe('KIAD');
Expand All @@ -154,7 +154,7 @@ describe('Label_13Through18_Slash', () => {
expect(decodeResult.decoded).toBe(true);

expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('On Ground Report');
expect(decodeResult.formatted.items.length).toBe(3);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -172,7 +172,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('On Ground Report');
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -197,7 +197,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('In Gate Report');
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -224,7 +224,7 @@ describe('Label_13Through18_Slash', () => {
expect(decodeResult.decoded).toBe(true);

expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('Post Report');
expect(decodeResult.formatted.items.length).toBe(2);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -244,7 +244,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('Post Report');
expect(decodeResult.formatted.items.length).toBe(3);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -269,7 +269,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('Post Times Report');
expect(decodeResult.formatted.items.length).toBe(3);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand All @@ -288,7 +288,7 @@ describe('Label_13Through18_Slash', () => {

expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.day_of_month).toBe(12);
expect(decodeResult.raw.day).toBe(12);
expect(decodeResult.formatted.description).toBe('Post Times Report');
expect(decodeResult.formatted.items.length).toBe(2);
expect(decodeResult.formatted.items[0].label).toBe('Origin');
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/Label_13Through18_Slash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Label_13Through18_Slash extends DecoderPlugin { // eslint-disable-l
const data = parts[2].split(' ');
ResultFormatter.departureAirport(decodeResult, data[1]);
ResultFormatter.arrivalAirport(decodeResult, data[2]);
decodeResult.raw.day_of_month = Number(data[3]);
decodeResult.raw.day = Number(data[3]);
const time = DateTimeUtils.convertHHMMSSToTod(data[4])
if (labelNumber === 13) {
ResultFormatter.out(decodeResult, time);
Expand Down
6 changes: 3 additions & 3 deletions lib/plugins/Label_22_OFF.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe('Label 22 OFF', () => {
expect(decodeResult.decoded).toBe(true);
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.flight_number).toBe('YX3661');
expect(decodeResult.raw.departure_day_of_month).toBe(25);
expect(decodeResult.raw.arrival_day_of_month).toBe(25);
expect(decodeResult.raw.departure_day).toBe(25);
expect(decodeResult.raw.arrival_day).toBe(25);
expect(decodeResult.raw.time_of_day).toBe(61920);
expect(decodeResult.raw.off_time).toBe(61927);
expect(decodeResult.raw.departure_icao).toBe('KIAD');
Expand Down Expand Up @@ -56,7 +56,7 @@ describe('Label 22 OFF', () => {
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.position.latitude).toBe(38.946666666666665);
expect(decodeResult.raw.position.longitude).toBe(-77.435);
expect(decodeResult.raw.day_of_month).toBe(25);
expect(decodeResult.raw.day).toBe(25);
expect(decodeResult.raw.time_of_day).toBe(42720);
expect(decodeResult.raw.off_time).toBe(42720);
expect(decodeResult.raw.departure_icao).toBe('KIAD');
Expand Down
56 changes: 30 additions & 26 deletions lib/plugins/Label_4J_POS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ describe('Label 4J POS', () => {
expect(decodeResult.raw.message_timestamp).toBe(1709476093);
expect(decodeResult.raw.flight_number).toBe('BANKR31');
expect(decodeResult.raw.mission_number).toBe('');
expect(decodeResult.formatted.items.length).toBe(7);
expect(decodeResult.formatted.items.length).toBe(8);
expect(decodeResult.formatted.items[0].label).toBe('Tail');
expect(decodeResult.formatted.items[0].value).toBe('91459S');
expect(decodeResult.formatted.items[1].label).toBe('Estimated Time of Arrival');
expect(decodeResult.formatted.items[1].value).toBe('15:39:00');
expect(decodeResult.formatted.items[2].label).toBe('Aircraft Position');
expect(decodeResult.formatted.items[2].value).toBe('39.462 N, 77.598 W');
expect(decodeResult.formatted.items[3].label).toBe('Aircraft Route');
expect(decodeResult.formatted.items[3].value).toBe('(39.500 N, 77.183 W)@14:28:00 > (38.933 N, 77.250 W)@03:14:30 > ?');
expect(decodeResult.formatted.items[4].label).toBe('Altitude');
expect(decodeResult.formatted.items[4].value).toBe('24000 feet');
expect(decodeResult.formatted.items[5].label).toBe('Outside Air Temperature (C)');
expect(decodeResult.formatted.items[5].value).toBe('-28 degrees');
expect(decodeResult.formatted.items[6].label).toBe('Message Checksum');
expect(decodeResult.formatted.items[6].value).toBe('0x9071');
expect(decodeResult.formatted.items[1].label).toBe('Day of Month');
expect(decodeResult.formatted.items[1].value).toBe('3');
expect(decodeResult.formatted.items[2].label).toBe('Estimated Time of Arrival');
expect(decodeResult.formatted.items[2].value).toBe('15:39:00');
expect(decodeResult.formatted.items[3].label).toBe('Aircraft Position');
expect(decodeResult.formatted.items[3].value).toBe('39.462 N, 77.598 W');
expect(decodeResult.formatted.items[4].label).toBe('Aircraft Route');
expect(decodeResult.formatted.items[4].value).toBe('(39.500 N, 77.183 W)@14:28:00 > (38.933 N, 77.250 W)@03:14:30 > ?');
expect(decodeResult.formatted.items[5].label).toBe('Altitude');
expect(decodeResult.formatted.items[5].value).toBe('24000 feet');
expect(decodeResult.formatted.items[6].label).toBe('Outside Air Temperature (C)');
expect(decodeResult.formatted.items[6].value).toBe('-28 degrees');
expect(decodeResult.formatted.items[7].label).toBe('Message Checksum');
expect(decodeResult.formatted.items[7].value).toBe('0x9071');
expect(decodeResult.remaining.text).toBe('MR64,0,27619,MT370/CG311,160,350/FB732/VR32');
});

Expand All @@ -64,21 +66,23 @@ describe('Label 4J POS', () => {
expect(decodeResult.raw.message_timestamp).toBe(1725804426);
expect(decodeResult.raw.flight_number).toBe('WIDE21');
expect(decodeResult.raw.mission_number).toBe('7PZWTCP21222');
expect(decodeResult.formatted.items.length).toBe(7);
expect(decodeResult.formatted.items.length).toBe(8);
expect(decodeResult.formatted.items[0].label).toBe('Tail');
expect(decodeResult.formatted.items[0].value).toBe('91517S');
expect(decodeResult.formatted.items[1].label).toBe('Estimated Time of Arrival');
expect(decodeResult.formatted.items[1].value).toBe('14:56:00');
expect(decodeResult.formatted.items[2].label).toBe('Aircraft Position');
expect(decodeResult.formatted.items[2].value).toBe('37.625 N, 77.613 W');
expect(decodeResult.formatted.items[3].label).toBe('Aircraft Route');
expect(decodeResult.formatted.items[3].value).toBe('JAXSN@14:07:00 > LOOEY@09:14:17 > ?');
expect(decodeResult.formatted.items[4].label).toBe('Altitude');
expect(decodeResult.formatted.items[4].value).toBe('30000 feet');
expect(decodeResult.formatted.items[5].label).toBe('Outside Air Temperature (C)');
expect(decodeResult.formatted.items[5].value).toBe('-26 degrees');
expect(decodeResult.formatted.items[6].label).toBe('Message Checksum');
expect(decodeResult.formatted.items[6].value).toBe('0xc696');
expect(decodeResult.formatted.items[1].label).toBe('Day of Month');
expect(decodeResult.formatted.items[1].value).toBe('9');
expect(decodeResult.formatted.items[2].label).toBe('Estimated Time of Arrival');
expect(decodeResult.formatted.items[2].value).toBe('14:56:00');
expect(decodeResult.formatted.items[3].label).toBe('Aircraft Position');
expect(decodeResult.formatted.items[3].value).toBe('37.625 N, 77.613 W');
expect(decodeResult.formatted.items[4].label).toBe('Aircraft Route');
expect(decodeResult.formatted.items[4].value).toBe('JAXSN@14:07:00 > LOOEY@09:14:17 > ?');
expect(decodeResult.formatted.items[5].label).toBe('Altitude');
expect(decodeResult.formatted.items[5].value).toBe('30000 feet');
expect(decodeResult.formatted.items[6].label).toBe('Outside Air Temperature (C)');
expect(decodeResult.formatted.items[6].value).toBe('-26 degrees');
expect(decodeResult.formatted.items[7].label).toBe('Message Checksum');
expect(decodeResult.formatted.items[7].value).toBe('0xc696');
expect(decodeResult.remaining.text).toBe('MR238,2,21329,M080T490/CG293,160,350/FB583/VR32');
});

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/Label_4N.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('decodes Label 4N variant 1', () => {
expect(decodeResult.decoder.name).toBe('label-4n');
expect(decodeResult.formatted.description).toBe('Airline Defined');
expect(decodeResult.message.text).toBe(text);
expect(decodeResult.raw.day_of_month).toBe('22');
expect(decodeResult.raw.day).toBe('22');
expect(decodeResult.remaining.text).toBe('02 0013 0072');
expect(decodeResult.formatted.items.length).toBe(4);
expect(decodeResult.formatted.items[0].code).toBe('ORG');
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/Label_4N.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Label_4N extends DecoderPlugin {
const fields = text.split(",");
if (text.length === 51) {
// variant 1
decodeResult.raw.day_of_month = text.substring(0, 2);
decodeResult.raw.day = text.substring(0, 2);
ResultFormatter.departureAirport(decodeResult, text.substring(8, 11));
ResultFormatter.arrivalAirport(decodeResult, text.substring(13, 16));
ResultFormatter.position(decodeResult, CoordinateUtils.decodeStringCoordinatesDecimalMinutes(text.substring(30, 45).replace(/^(.)0/, "$1")));
Expand Down
10 changes: 5 additions & 5 deletions lib/plugins/Label_5Z_Slash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Label 5Z', () => {
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.airline).toBe('United Airlines');
expect(decodeResult.raw.message_type).toBe('B3');
expect(decodeResult.raw.day_of_month).toBe(14);
expect(decodeResult.raw.day).toBe(14);
expect(decodeResult.raw.departure_iata).toBe('ATL');
expect(decodeResult.raw.arrival_iata).toBe('IAD');
expect(decodeResult.raw.arrival_runway).toBe('1C');
Expand All @@ -65,7 +65,7 @@ describe('Label 5Z', () => {
expect(decodeResult.decoder.decodeLevel).toBe('full');
expect(decodeResult.raw.airline).toBe('United Airlines');
expect(decodeResult.raw.message_type).toBe('B3');
expect(decodeResult.raw.day_of_month).toBe(14);
expect(decodeResult.raw.day).toBe(14);
expect(decodeResult.raw.departure_iata).toBe('DCA');
expect(decodeResult.raw.arrival_iata).toBe('ORD');
expect(decodeResult.raw.arrival_runway).toBe('27C');
Expand All @@ -90,7 +90,7 @@ describe('Label 5Z', () => {
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.airline).toBe('United Airlines');
expect(decodeResult.raw.message_type).toBe('B3');
expect(decodeResult.raw.day_of_month).toBe(14);
expect(decodeResult.raw.day).toBe(14);
expect(decodeResult.raw.time_of_day).toBe(55532);
expect(decodeResult.raw.departure_icao).toBe('KIAH');
expect(decodeResult.raw.arrival_icao).toBe('KBOS');
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Label 5Z', () => {
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.airline).toBe('United Airlines');
expect(decodeResult.raw.time_of_day).toBe(44759);
expect(decodeResult.raw.day_of_month).toBe(20);
expect(decodeResult.raw.day).toBe(20);
expect(decodeResult.raw.departure_icao).toBe('KEWR');
expect(decodeResult.raw.arrival_icao).toBe('KBNA');
expect(decodeResult.raw.eta_time).toBe(48960);
Expand Down Expand Up @@ -165,7 +165,7 @@ describe('Label 5Z', () => {
expect(decodeResult.decoder.decodeLevel).toBe('partial');
expect(decodeResult.raw.airline).toBe('United Airlines');
expect(decodeResult.raw.time_of_day).toBe(42840);
expect(decodeResult.raw.day_of_month).toBe(22);
expect(decodeResult.raw.day).toBe(22);
expect(decodeResult.raw.departure_icao).toBe('KBNA');
expect(decodeResult.raw.arrival_icao).toBe('KEWR');
expect(decodeResult.formatted.items.length).toBe(5);
Expand Down
8 changes: 4 additions & 4 deletions lib/plugins/Label_5Z_Slash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ export class Label_5Z_Slash extends DecoderPlugin {
//info[0] is blank
ResultFormatter.departureAirport(decodeResult, info[1]);
ResultFormatter.arrivalAirport(decodeResult, info[2]);
decodeResult.raw.day_of_month = Number(info[3]);
decodeResult.raw.day = Number(info[3]);
ResultFormatter.time_of_day(decodeResult, DateTimeUtils.convertHHMMSSToTod(info[4]));
ResultFormatter.arrivalRunway(decodeResult, info[5].slice(1));
ResultFormatter.unknownArr(decodeResult, data.slice(3), '/');
} else if (type === 'B3') {
ResultFormatter.departureAirport(decodeResult, header[1].substring(0, 3), 'IATA');
ResultFormatter.arrivalAirport(decodeResult, header[1].substring(3), 'IATA');
decodeResult.raw.day_of_month = Number(header[2]);
decodeResult.raw.day = Number(header[2]);
ResultFormatter.arrivalRunway(decodeResult, header[3].slice(1));
if (header.length > 4) {
ResultFormatter.unknownArr(decodeResult, header.slice(4), '/');
Expand All @@ -97,7 +97,7 @@ export class Label_5Z_Slash extends DecoderPlugin {
//info[0] is blank
ResultFormatter.departureAirport(decodeResult, info[1]);
ResultFormatter.arrivalAirport(decodeResult, info[2]);
decodeResult.raw.day_of_month = Number(info[3]);
decodeResult.raw.day = Number(info[3]);
ResultFormatter.time_of_day(decodeResult, DateTimeUtils.convertHHMMSSToTod(info[4]));
ResultFormatter.unknownArr(decodeResult, info.slice(5), ' ');
} else if (type === 'C3') {
Expand All @@ -108,7 +108,7 @@ export class Label_5Z_Slash extends DecoderPlugin {
// aiports[0] is blank
ResultFormatter.departureAirport(decodeResult, airports[1]);
ResultFormatter.arrivalAirport(decodeResult, airports[2]);
decodeResult.raw.day_of_month = Number(airports[3]);
decodeResult.raw.day = Number(airports[3]);
ResultFormatter.time_of_day(decodeResult, DateTimeUtils.convertHHMMSSToTod(airports[4]));

const estimates = data[3].split(' ');
Expand Down
Loading