With Congress only narrowly averting a partial government shutdown this week, and even then just punting the hard decisions until next year, it’s understandable that the legislative body is seen by most Americans as broken and dysfunctional.

Congress’s job approval consistently hovers around a low 20 percent. Profiles in courage are rare on Capitol Hill. Lawmakers are viewed as being more concerned about their own job security than the betterment of the country.

But the passage Tuesday night of criminal justice legislation, an almost decade-in-the-making bipartisan endeavor, caps a year of Congress working to get some significant laws passed with overwhelming bipartisan support.

The criminal justice bill was a priority for conservatives and liberals but in previous years had struggled to gain traction. Advocacy groups diametrically opposed on almost every other issue coalesced to argue its merits. To get it passed, Democrats and Republicans did a thing they so rarely do anymore: They compromised. The bill sailed through the Senate 87-12.

A similar dynamic played out last week when the Senate and the House passed a farm bill. In this case, what was cut from the bill is as important as what made it in. GOP lawmakers removed stricter rules around work requirements for food stamp recipients, which was a big sticking point for Democrats. The bill passed the Senate 87-13.

Just before the midterms, Congress also successfully got to the president’s desk a massive package of proposals related to curbing the nation’s opioid crisis. While some public health advocates complained that the bill didn’t authorize nearly enough funding to be effective, lawmakers were still given credit for taking action to address the crisis. The bill passed 98-1.

Then there’s the business of funding the government. Congress managed to get five of its 12 appropriations bills done before the fiscal year ended Sept. 30. It might not seem that impressive a feat, except that it was the most appropriation bills completed on time in 20 years. A package that contained funding for energy, water, veterans and the legislative branch passed the Senate 92-6. Then funding for defense, labor, health and education were wrapped into one bill and passed 85-7.

Of course, that still leaves seven spending bills that not only didn’t get done on time but also, with the news of a two-week continuing resolution to keep the government open, will not get passed until at least January, a month before President Trump will send Congress his budget proposal for fiscal 2020.

No one is suggesting that Congress be celebrated for managing to do its job a few times this year.

But at least it did more than nothing . . . and kept the government open.