Skip to content

Setting a smart list to limit, will randomized the lists of books #193

@maforget

Description

@maforget

Describe the bug
When creating a smart list you can change a setting to limit the lists of books. This lists will be random until you refresh. The change log for v0.9.147 says:

  • CHANGE: Smartlists with limit criteria are no longer randomized

The code doesn't seem to do that.

Default values are still set to Random

[DefaultValue(ComicSmartListLimitSelectionType.Random)]
public ComicSmartListLimitSelectionType LimitSelectionType

LimitSelectionType = ComicSmartListLimitSelectionType.Random;

Exact Steps to Reproduce
Steps to reproduce the behavior:

  1. Create a Smart list
  2. Set a limit for that list
  3. Refresh (F5)

Version/Commit (check the about page, next to the version, for the string between brackets):

Additional context
The code correctly checks the type of sorting

switch (LimitSelectionType)
{
case ComicSmartListLimitSelectionType.SortedBySeries:
enumerable = enumerable.ToList().OrderBy((ComicBook cb) => cb, new ComicBookSeriesComparer());
break;
default:
if (LimitRandomSeed == 0)
{
LimitRandomSeed = new Random().Next();
}
enumerable = enumerable.OrderBy((ComicBook l) => l.Id).ToList().Randomize(LimitRandomSeed);
break;
case ComicSmartListLimitSelectionType.Position:
break;

The Default & Random have the same value

public enum ComicSmartListLimitSelectionType
{
Position = 0,
SortedBySeries = 1,
Random = 2,
Default = 2

And since the default value is set to Random it will never hit the code, unless manually changed in the database. If the value is set in the database, then changing the default wouldn't do anything. But since it's the default it is normally not saved so might impact less users. Adding a UI to change it might be possible.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions