Cleans up and removes TODOs, adds tests (#844)

* removes version ordering from v2; simplifies now-unecessary three-level faceting

* resolved some todos

* test for game version updating

* merge fixes; display_categories fix
This commit is contained in:
Wyatt Verchere
2024-01-11 18:11:27 -08:00
committed by GitHub
parent 76c885f080
commit ef31c0c0da
24 changed files with 243 additions and 241 deletions

View File

@@ -101,7 +101,6 @@ impl LegacyProject {
// Requires any queried versions to be passed in, to get access to certain version fields contained within.
// - This can be any version, because the fields are ones that used to be on the project itself.
// - Its conceivable that certain V3 projects that have many different ones may not have the same fields on all of them.
// TODO: Should this return an error instead for v2 users?
// It's safe to use a db version_item for this as the only info is side types, game versions, and loader fields (for loaders), which used to be public on project anyway.
pub fn from(data: Project, versions_item: Option<version_item::QueryVersion>) -> Self {
let mut client_side = LegacySideType::Unknown;
@@ -289,10 +288,6 @@ pub struct LegacyVersion {
/// A list of loaders this project supports (has a newtype struct)
pub loaders: Vec<Loader>,
// TODO: should we remove this? as this is a v3 field and tests for it should be isolated to v3
// it allows us to keep tests that use this struct in common
pub ordering: Option<i32>,
pub id: VersionId,
pub project_id: ProjectId,
pub author_id: UserId,
@@ -354,7 +349,6 @@ impl From<Version> for LegacyVersion {
files: data.files,
dependencies: data.dependencies,
game_versions,
ordering: data.ordering,
loaders,
}
}

View File

@@ -42,7 +42,7 @@ pub struct LegacyResultSearchProject {
impl LegacyResultSearchProject {
pub fn from(result_search_project: ResultSearchProject) -> Self {
let mut categories = result_search_project.categories;
categories.extend(result_search_project.loaders);
categories.extend(result_search_project.loaders.clone());
if categories.contains(&"mrpack".to_string()) {
if let Some(mrpack_loaders) = result_search_project
.project_loader_fields
@@ -58,6 +58,7 @@ impl LegacyResultSearchProject {
}
}
let mut display_categories = result_search_project.display_categories;
display_categories.extend(result_search_project.loaders);
if display_categories.contains(&"mrpack".to_string()) {
if let Some(mrpack_loaders) = result_search_project
.project_loader_fields