• Alfredo Di Napoli's avatar
    Fix bug in selectCountDocs · 6ff05ee1
    Alfredo Di Napoli authored
    The refactored DB API now has a separate building block to create an Opaleye query that
    counts the number of returned results; we do that via `countRows`, exactly like the previous version.
    
    However, I have discovered a small footgun in the Opaleye API -- if you have
    two `Select` statements both calling countRows in a chain, that will always yield a value of 1,
    because the inner `countRows` will give you the actual number of results by returning
    a single row with an integer inside (i.e. the count).
    
    However, the subsequent (outer) call to `countRows` will return the number of rows
    of the previous step .. which is always going to be one!
    
    The bug was that I had left somewhere the spurious `countRows` in the query which
    would return the number of documents needed for the TFICF field, triggering the bug
    (because then we had `it` ALWAYS equal to 1.0).
    
    In the new API, while we cannot prevent the bug at the type level we can
    easily do an audit by grepping for `countRows`, making sure we have exactly one instance,
    i.e. inside `mkOpaCountQuery`.
    6ff05ee1
Name
Last commit
Last update
.gitlab/issue_templates Loading commit data...
bench Loading commit data...
bench-data/phylo Loading commit data...
bin Loading commit data...
devops Loading commit data...
docs Loading commit data...
ekg-assets Loading commit data...
nix Loading commit data...
src Loading commit data...
src-doctest Loading commit data...
test Loading commit data...
test-data Loading commit data...
.clippy.dhall Loading commit data...
.envrc Loading commit data...
.ghci Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
.mailmap Loading commit data...
CHANGELOG.md Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
DEVELOPER_GUIDELINES.md Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
cabal.project Loading commit data...
cabal.project.freeze Loading commit data...
cabal.project.local_toCopy Loading commit data...
gargantext-settings.toml_toModify Loading commit data...
gargantext.cabal Loading commit data...
gargantext.ini_toModify Loading commit data...
hie.yaml Loading commit data...
run Loading commit data...
shell.nix Loading commit data...
stack.yaml Loading commit data...
start Loading commit data...
weeder.toml Loading commit data...