Getting the state of a joystick button BGE
You're checking the button status, but the constants used are for sensor statuses. For those checkings, use sensor.status instead of sensor.getButtonStatus. Example:

if joysticksens.status == bge.logic.KX_INPUT_JUST_ACTIVATED:
    print("just pressed")


Remember that sensor.getButtonStatus returns only True or False, and equals to the expression:

BUTTON in bge.logic.joystics[0].activeButtons


Use the sensor.getButtonStatus along with sensor.status to check if a given button is pressed and which status of sensor at the same time.

Below, your file reworked using the method I mentioned, and few additions:


Optimized by using Module mode instead of Script mode in controller
Keyboard status checking without using the Keyboard sensor.