Speed up tag count queries (#570)

* Speed up tag count queries
* Add test for marker CountByTagID

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
InfiniteTF
2020-05-24 08:18:02 +02:00
committed by GitHub
parent 95a6d3ea2f
commit 32fce9ac6f
3 changed files with 37 additions and 12 deletions

View File

@@ -32,10 +32,37 @@ func TestMarkerFindBySceneID(t *testing.T) {
assert.Len(t, markers, 0)
}
func TestMarkerCountByTagID(t *testing.T) {
mqb := models.NewSceneMarkerQueryBuilder()
markerCount, err := mqb.CountByTagID(tagIDs[tagIdxWithPrimaryMarker])
if err != nil {
t.Fatalf("error calling CountByTagID: %s", err.Error())
}
assert.Equal(t, 1, markerCount)
markerCount, err = mqb.CountByTagID(tagIDs[tagIdxWithMarker])
if err != nil {
t.Fatalf("error calling CountByTagID: %s", err.Error())
}
assert.Equal(t, 1, markerCount)
markerCount, err = mqb.CountByTagID(0)
if err != nil {
t.Fatalf("error calling CountByTagID: %s", err.Error())
}
assert.Equal(t, 0, markerCount)
}
// TODO Update
// TODO Destroy
// TODO Find
// TODO CountByTagID
// TODO GetMarkerStrings
// TODO Wall
// TODO Query