Push filtering, sorting and pagination into the database layer
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
先阅读 LearnStack.Core/Services/LearningResourceService.cs:12-21 和 :74-96,然后检查 Resources.razor:636-643 和 Pulse.razor.cs:60。在引入查询/筛选和分页结果设计之前,先追踪当前内存中操作的工作方式。完成标准是:每个资源列表页面执行一次查询、执行一次带索引的重复 URL 查找,并且 Pulse 聚合不对整个库进行实体化。
由索引模型根据 Issue 内容生成。
描述
Tier 2 — scale
Problem
GetAllAsync(userId) loads a user's entire library into memory (thumbnails included); the component then filters, sorts and pages it client-side. UrlExistsAsync loads every URL a user owns just to compare one. Pulse loads everything to compute aggregates. This is fine at 50 resources and collapses at 5,000.
Evidence
LearnStack.Core/Services/LearningResourceService.cs:12-21—GetAllAsyncLearnStack.Core/Services/LearningResourceService.cs:74-96—UrlExistsAsyncmaterializes all URLsLearnStack/Components/Pages/Resources.razor:636-643— in-memory pagingLearnStack/Components/Pages/Pulse.razor.cs:60— loads all resources for aggregates
Proposed fix
- Introduce a query/filter object and return a paged result (
Items,TotalCount) from the service. - Apply search, status/type/priority filters, sorting and
Skip/TakeinIQueryable. - Add a persisted
NormalizedUrlcolumn with a unique index per user, and replaceUrlExistsAsyncwith a single indexed lookup. - Compute Pulse aggregates with
GroupByin SQL rather than in memory.
Acceptance criteria
- Resource list issues one query per page regardless of library size
- Duplicate-URL check is a single indexed query
- Pulse does not materialize the full library
- 主要语言
- HTML
- 星标
- 10
- 派生
- 0
- 平均合并
- 2 小时 35 分钟
- 30 天内合并 PR
- 21
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
kasuken/LearnStack 的其他 Issue
-
enhancement
难度 1/5 1 小时以内 新手友好度 91/100
kasuken/LearnStack#59 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
kasuken/LearnStack#72 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
kasuken/LearnStack#71 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
kasuken/LearnStack#70 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 45/100
kasuken/LearnStack#69 ·
维护者通常 1 天内回复
查看 kasuken/LearnStack 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
BC remittance upload: a claim MSP refused (S03) is saved with a blank status instead of refused (F)未关闭type: bug
难度 2/5 1-3 小时 新手友好度 88/100
carlos-emr/carlos#4933 ·
维护者通常 1 天内回复
-
Authentication / Authorization Feature: Volunteer
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
Emanuele-web04/remodex#203 ·
维护者通常 1 天内回复
-
area:protocol bug
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复