openwebwork / webwork2

Course management front end for WeBWorK
http://webwork.maa.org/wiki/Main_Page
Other
145 stars 165 forks source link

Fix cross listed OPL problems in the library browser. #2388

Closed drgrice1 closed 5 months ago

drgrice1 commented 6 months ago

The database query used to count and list OPL and Contrib problems was not good enough to narrow down to a single cross listed problem listing in the OPL database. As a result a single problem would be listed multiple times if a datbaase subject is not selected. For example, if a textbook, text chapter, and text section are selected but not a database chapter. This fixes issue #2387. See that issue for details. Note that this could be improved upon by changing the OPL database. The structure of the OPL database is not good. There is absolutely no reason that the libraryroot, pg file path, and pg file basename should be stored in separate columns, much less in separate tables.

To make that work well the values of the select options needed to be switched from being the human readable texts that are shown to being the database ids of the things the select represent. This also fixes another issue that I have known about for a while now. If you are on the "Basic Search" page (the initial page) of the library browser, select the subject "Calculus - single variable", chapter "Limits and continuity", and section "Motivational applications (estimation)", and then click on the "Advanced Search" button, this results in a heavy spike in CPU usage and a long delay before the page actually loads. That happens with other selections as well, but how bad it is varies with what is selected.

Also remove the plurals from the select names that don't make sense since they represenet a singular quantity.

This also removes support for OPLv1 (as the TODO in SetMaker.pm suggests). There is no reason to support that anymore. Not all of the scripts have the version check removed yet though.

Generally clean up the ListingDB.pm file.

Alex-Jordan commented 5 months ago

This works and I will merge now.