Refactor: scheduler: reorganize lrm_resources unpacker
Drill down from node_state to lrm_resources within the function rather than
before it, so it's more self-contained, and unpack_node_history() is cleaner.
Rename it accordingly.
Also comment it better, and use convenience functions to simplify a bit.