Count parameter in Paging class seems to be incorrect #151
-
Hello, app.MapGet("summeries", (string filter) =>
{
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
var data = Enumerable.Range(1, 20).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = summaries[Random.Shared.Next(summaries.Length)]
});
var gq = new GridifyQuery() { Filter = filter};
return new { gq = data.AsQueryable().Gridify(gq), data };
}); and result was: Collapsed due to long height{
"gq": {
"count": 2,
"data": [
{
"date": "2024-02-16T12:08:37.1401968+03:30",
"temperatureC": -11,
"temperatureF": 13,
"summary": "Cool"
},
{
"date": "2024-02-19T12:08:37.1402092+03:30",
"temperatureC": 35,
"temperatureF": 94,
"summary": "Cool"
},
{
"date": "2024-02-25T12:08:37.1402186+03:30",
"temperatureC": 23,
"temperatureF": 73,
"summary": "Cool"
}
]
},
"data": [
{
"date": "2024-02-15T12:08:37.1442944+03:30",
"temperatureC": 37,
"temperatureF": 98,
"summary": "Balmy"
},
{
"date": "2024-02-16T12:08:37.144311+03:30",
"temperatureC": -1,
"temperatureF": 31,
"summary": "Balmy"
},
{
"date": "2024-02-17T12:08:37.1443133+03:30",
"temperatureC": -13,
"temperatureF": 9,
"summary": "Mild"
},
{
"date": "2024-02-18T12:08:37.1443167+03:30",
"temperatureC": 14,
"temperatureF": 57,
"summary": "Warm"
},
{
"date": "2024-02-19T12:08:37.1443184+03:30",
"temperatureC": 44,
"temperatureF": 111,
"summary": "Warm"
},
{
"date": "2024-02-20T12:08:37.1443195+03:30",
"temperatureC": -1,
"temperatureF": 31,
"summary": "Scorching"
},
{
"date": "2024-02-21T12:08:37.1443228+03:30",
"temperatureC": 48,
"temperatureF": 118,
"summary": "Freezing"
},
{
"date": "2024-02-22T12:08:37.1443247+03:30",
"temperatureC": 6,
"temperatureF": 42,
"summary": "Sweltering"
},
{
"date": "2024-02-23T12:08:37.1443257+03:30",
"temperatureC": -4,
"temperatureF": 25,
"summary": "Freezing"
},
{
"date": "2024-02-24T12:08:37.1443266+03:30",
"temperatureC": 52,
"temperatureF": 125,
"summary": "Sweltering"
},
{
"date": "2024-02-25T12:08:37.1443282+03:30",
"temperatureC": 32,
"temperatureF": 89,
"summary": "Bracing"
},
{
"date": "2024-02-26T12:08:37.1443378+03:30",
"temperatureC": 3,
"temperatureF": 37,
"summary": "Balmy"
},
{
"date": "2024-02-27T12:08:37.1443509+03:30",
"temperatureC": 23,
"temperatureF": 73,
"summary": "Warm"
},
{
"date": "2024-02-28T12:08:37.1443521+03:30",
"temperatureC": 5,
"temperatureF": 40,
"summary": "Scorching"
},
{
"date": "2024-02-29T12:08:37.144353+03:30",
"temperatureC": 30,
"temperatureF": 85,
"summary": "Hot"
},
{
"date": "2024-03-01T12:08:37.1443539+03:30",
"temperatureC": 24,
"temperatureF": 75,
"summary": "Bracing"
},
{
"date": "2024-03-02T12:08:37.1443549+03:30",
"temperatureC": -19,
"temperatureF": -2,
"summary": "Hot"
},
{
"date": "2024-03-03T12:08:37.1443559+03:30",
"temperatureC": 16,
"temperatureF": 60,
"summary": "Scorching"
},
{
"date": "2024-03-04T12:08:37.1443571+03:30",
"temperatureC": 1,
"temperatureF": 33,
"summary": "Scorching"
},
{
"date": "2024-03-05T12:08:37.144358+03:30",
"temperatureC": -3,
"temperatureF": 27,
"summary": "Cool"
}
]
} As you can see, Gridify found 3 objects but returned 2 in the count parameter. |
Beta Was this translation helpful? Give feedback.
Answered by
alirezanet
Feb 14, 2024
Replies: 1 comment 1 reply
-
Hi @SARM256, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
SARM256
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @SARM256,
I think this is happening because you're using runtime random generated data and this code is being evaluated twice. please add
ToList
at the end of your data generation logic and test it again to make sure you have a consistent data source.