diff --git a/bls-register-backend/src/processor/index.js b/bls-register-backend/src/processor/index.js index db6c4a9..ec34a61 100644 --- a/bls-register-backend/src/processor/index.js +++ b/bls-register-backend/src/processor/index.js @@ -223,7 +223,7 @@ export const buildRowsFromPayload = (rawPayload) => { return { registerRows: [registerRow], - roomStatusRows: [roomStatusUpdateRow] + roomStatusRows: registerRow.is_send === 0 ? [roomStatusUpdateRow] : [] }; }; diff --git a/bls-register-backend/tests/processor.test.js b/bls-register-backend/tests/processor.test.js index 1bac054..2ad9d2b 100644 --- a/bls-register-backend/tests/processor.test.js +++ b/bls-register-backend/tests/processor.test.js @@ -36,6 +36,13 @@ describe('Register Processor', () => { expect(rows.roomStatusRows[0].hotel_id).toBe(0); }); + it('should skip room_status updates when is_send is not 0', () => { + const rows = buildRowsFromPayload({ ...basePayload, is_send: 1 }); + expect(rows.registerRows).toHaveLength(1); + expect(rows.registerRows[0].is_send).toBe(1); + expect(rows.roomStatusRows).toHaveLength(0); + }); + it('should convert udp_raw byte array to base64 text', () => { const rows = buildRowsFromPayload({ ...basePayload,