Setting rank column defaults to a small number. Fixes #4178 (#4191)

* Setting rank column defaults to a small number. Fixes #4178

* Fixing tests.
This commit is contained in:
Dessalines 2023-11-23 20:39:46 -05:00 committed by GitHub
parent 26297b4035
commit 6e4278b1c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 118 additions and 90 deletions

View file

@ -19,17 +19,17 @@
"api-test-image": "jest -i image.spec.ts" "api-test-image": "jest -i image.spec.ts"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.8", "@types/jest": "^29.5.10",
"@types/node": "^20.9.0", "@types/node": "^20.9.4",
"@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.10.0", "@typescript-eslint/parser": "^6.12.0",
"download-file-sync": "^1.0.4", "download-file-sync": "^1.0.4",
"eslint": "^8.53.0", "eslint": "^8.54.0",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.0.1",
"jest": "^29.5.0", "jest": "^29.5.0",
"lemmy-js-client": "0.19.0-alpha.18", "lemmy-js-client": "0.19.0-alpha.18",
"prettier": "^3.0.0", "prettier": "^3.1.0",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"typescript": "^5.0.4" "typescript": "^5.3.2"
} }
} }

View file

@ -329,10 +329,10 @@
minimatch "^3.1.2" minimatch "^3.1.2"
strip-json-comments "^3.1.1" strip-json-comments "^3.1.1"
"@eslint/js@8.53.0": "@eslint/js@8.54.0":
version "8.53.0" version "8.54.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.53.0.tgz#bea56f2ed2b5baea164348ff4d5a879f6f81f20d" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.54.0.tgz#4fab9a2ff7860082c304f750e94acd644cf984cf"
integrity sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w== integrity sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==
"@humanwhocodes/config-array@^0.11.13": "@humanwhocodes/config-array@^0.11.13":
version "0.11.13" version "0.11.13"
@ -704,10 +704,10 @@
dependencies: dependencies:
"@types/istanbul-lib-report" "*" "@types/istanbul-lib-report" "*"
"@types/jest@^29.5.8": "@types/jest@^29.5.10":
version "29.5.8" version "29.5.10"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.8.tgz#ed5c256fe2bc7c38b1915ee5ef1ff24a3427e120" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.10.tgz#a10fc5bab9e426081c12b2ef73d24d4f0c9b7f50"
integrity sha512-fXEFTxMV2Co8ZF5aYFJv+YeA08RTYJfhtN5c9JSv/mFEMe+xxjufCb+PHL+bJcMs/ebPUsBu+UNTEz+ydXrR6g== integrity sha512-tE4yxKEphEyxj9s4inideLHktW/x6DwesIwWZ9NN1FKf9zbJYsnhBoA9vrHA/IuIOKwPa5PcFBNV4lpMIOEzyQ==
dependencies: dependencies:
expect "^29.0.0" expect "^29.0.0"
pretty-format "^29.0.0" pretty-format "^29.0.0"
@ -722,10 +722,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.0.tgz#10ddf0119cf20028781c06d7115562934e53f745" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.0.tgz#10ddf0119cf20028781c06d7115562934e53f745"
integrity sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ== integrity sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ==
"@types/node@^20.9.0": "@types/node@^20.9.4":
version "20.9.0" version "20.9.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.4.tgz#cc8f970e869c26834bdb7ed480b30ede622d74c7"
integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== integrity sha512-wmyg8HUhcn6ACjsn8oKYjkN/zUzQeNtMy44weTJSM6p4MMzEOuKbA3OjJ267uPCOW7Xex9dyrNTful8XTQYoDA==
dependencies: dependencies:
undici-types "~5.26.4" undici-types "~5.26.4"
@ -751,16 +751,16 @@
dependencies: dependencies:
"@types/yargs-parser" "*" "@types/yargs-parser" "*"
"@typescript-eslint/eslint-plugin@^6.10.0": "@typescript-eslint/eslint-plugin@^6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.10.0.tgz#cfe2bd34e26d2289212946b96ab19dcad64b661a" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz#2a647d278bb48bf397fef07ba0507612ff9dd812"
integrity sha512-uoLj4g2OTL8rfUQVx2AFO1hp/zja1wABJq77P6IclQs6I/m9GLrm7jCdgzZkvWdDCQf1uEvoa8s8CupsgWQgVg== integrity sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA==
dependencies: dependencies:
"@eslint-community/regexpp" "^4.5.1" "@eslint-community/regexpp" "^4.5.1"
"@typescript-eslint/scope-manager" "6.10.0" "@typescript-eslint/scope-manager" "6.12.0"
"@typescript-eslint/type-utils" "6.10.0" "@typescript-eslint/type-utils" "6.12.0"
"@typescript-eslint/utils" "6.10.0" "@typescript-eslint/utils" "6.12.0"
"@typescript-eslint/visitor-keys" "6.10.0" "@typescript-eslint/visitor-keys" "6.12.0"
debug "^4.3.4" debug "^4.3.4"
graphemer "^1.4.0" graphemer "^1.4.0"
ignore "^5.2.4" ignore "^5.2.4"
@ -768,72 +768,72 @@
semver "^7.5.4" semver "^7.5.4"
ts-api-utils "^1.0.1" ts-api-utils "^1.0.1"
"@typescript-eslint/parser@^6.10.0": "@typescript-eslint/parser@^6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.10.0.tgz#578af79ae7273193b0b6b61a742a2bc8e02f875a" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.12.0.tgz#9fb21ed7d88065a4a2ee21eb80b8578debb8217c"
integrity sha512-+sZwIj+s+io9ozSxIWbNB5873OSdfeBEH/FR0re14WLI6BaKuSOnnwCJ2foUiu8uXf4dRp1UqHP0vrZ1zXGrog== integrity sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg==
dependencies: dependencies:
"@typescript-eslint/scope-manager" "6.10.0" "@typescript-eslint/scope-manager" "6.12.0"
"@typescript-eslint/types" "6.10.0" "@typescript-eslint/types" "6.12.0"
"@typescript-eslint/typescript-estree" "6.10.0" "@typescript-eslint/typescript-estree" "6.12.0"
"@typescript-eslint/visitor-keys" "6.10.0" "@typescript-eslint/visitor-keys" "6.12.0"
debug "^4.3.4" debug "^4.3.4"
"@typescript-eslint/scope-manager@6.10.0": "@typescript-eslint/scope-manager@6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.10.0.tgz#b0276118b13d16f72809e3cecc86a72c93708540" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz#5833a16dbe19cfbad639d4d33bcca5e755c7044b"
integrity sha512-TN/plV7dzqqC2iPNf1KrxozDgZs53Gfgg5ZHyw8erd6jd5Ta/JIEcdCheXFt9b1NYb93a1wmIIVW/2gLkombDg== integrity sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==
dependencies: dependencies:
"@typescript-eslint/types" "6.10.0" "@typescript-eslint/types" "6.12.0"
"@typescript-eslint/visitor-keys" "6.10.0" "@typescript-eslint/visitor-keys" "6.12.0"
"@typescript-eslint/type-utils@6.10.0": "@typescript-eslint/type-utils@6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.10.0.tgz#1007faede067c78bdbcef2e8abb31437e163e2e1" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz#968f7c95162808d69950ab5dff710ad730e58287"
integrity sha512-wYpPs3hgTFblMYwbYWPT3eZtaDOjbLyIYuqpwuLBBqhLiuvJ+9sEp2gNRJEtR5N/c9G1uTtQQL5AhV0fEPJYcg== integrity sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng==
dependencies: dependencies:
"@typescript-eslint/typescript-estree" "6.10.0" "@typescript-eslint/typescript-estree" "6.12.0"
"@typescript-eslint/utils" "6.10.0" "@typescript-eslint/utils" "6.12.0"
debug "^4.3.4" debug "^4.3.4"
ts-api-utils "^1.0.1" ts-api-utils "^1.0.1"
"@typescript-eslint/types@6.10.0": "@typescript-eslint/types@6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.10.0.tgz#f4f0a84aeb2ac546f21a66c6e0da92420e921367" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.12.0.tgz#ffc5297bcfe77003c8b7b545b51c2505748314ac"
integrity sha512-36Fq1PWh9dusgo3vH7qmQAj5/AZqARky1Wi6WpINxB6SkQdY5vQoT2/7rW7uBIsPDcvvGCLi4r10p0OJ7ITAeg== integrity sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==
"@typescript-eslint/typescript-estree@6.10.0": "@typescript-eslint/typescript-estree@6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.10.0.tgz#667381eed6f723a1a8ad7590a31f312e31e07697" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz#764ccc32598549e5b48ec99e3b85f89b1385310c"
integrity sha512-ek0Eyuy6P15LJVeghbWhSrBCj/vJpPXXR+EpaRZqou7achUWL8IdYnMSC5WHAeTWswYQuP2hAZgij/bC9fanBg== integrity sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==
dependencies: dependencies:
"@typescript-eslint/types" "6.10.0" "@typescript-eslint/types" "6.12.0"
"@typescript-eslint/visitor-keys" "6.10.0" "@typescript-eslint/visitor-keys" "6.12.0"
debug "^4.3.4" debug "^4.3.4"
globby "^11.1.0" globby "^11.1.0"
is-glob "^4.0.3" is-glob "^4.0.3"
semver "^7.5.4" semver "^7.5.4"
ts-api-utils "^1.0.1" ts-api-utils "^1.0.1"
"@typescript-eslint/utils@6.10.0": "@typescript-eslint/utils@6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.10.0.tgz#4d76062d94413c30e402c9b0df8c14aef8d77336" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.12.0.tgz#c6ce8c06fe9b0212620e5674a2036f6f8f611754"
integrity sha512-v+pJ1/RcVyRc0o4wAGux9x42RHmAjIGzPRo538Z8M1tVx6HOnoQBCX/NoadHQlZeC+QO2yr4nNSFWOoraZCAyg== integrity sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ==
dependencies: dependencies:
"@eslint-community/eslint-utils" "^4.4.0" "@eslint-community/eslint-utils" "^4.4.0"
"@types/json-schema" "^7.0.12" "@types/json-schema" "^7.0.12"
"@types/semver" "^7.5.0" "@types/semver" "^7.5.0"
"@typescript-eslint/scope-manager" "6.10.0" "@typescript-eslint/scope-manager" "6.12.0"
"@typescript-eslint/types" "6.10.0" "@typescript-eslint/types" "6.12.0"
"@typescript-eslint/typescript-estree" "6.10.0" "@typescript-eslint/typescript-estree" "6.12.0"
semver "^7.5.4" semver "^7.5.4"
"@typescript-eslint/visitor-keys@6.10.0": "@typescript-eslint/visitor-keys@6.12.0":
version "6.10.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.10.0.tgz#b9eaf855a1ac7e95633ae1073af43d451e8f84e3" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz#5877950de42a0f3344261b7a1eee15417306d7e9"
integrity sha512-xMGluxQIEtOM7bqFCo+rCMh5fqI+ZxV5RUUOa29iVPz1OgCZrtc7rFnz5cLUazlkPKYqX+75iuDq7m0HQ48nCg== integrity sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==
dependencies: dependencies:
"@typescript-eslint/types" "6.10.0" "@typescript-eslint/types" "6.12.0"
eslint-visitor-keys "^3.4.1" eslint-visitor-keys "^3.4.1"
"@ungap/structured-clone@^1.2.0": "@ungap/structured-clone@^1.2.0":
@ -1338,15 +1338,15 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
eslint@^8.53.0: eslint@^8.54.0:
version "8.53.0" version "8.54.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.53.0.tgz#14f2c8244298fcae1f46945459577413ba2697ce" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.54.0.tgz#588e0dd4388af91a2e8fa37ea64924074c783537"
integrity sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag== integrity sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==
dependencies: dependencies:
"@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/eslint-utils" "^4.2.0"
"@eslint-community/regexpp" "^4.6.1" "@eslint-community/regexpp" "^4.6.1"
"@eslint/eslintrc" "^2.1.3" "@eslint/eslintrc" "^2.1.3"
"@eslint/js" "8.53.0" "@eslint/js" "8.54.0"
"@humanwhocodes/config-array" "^0.11.13" "@humanwhocodes/config-array" "^0.11.13"
"@humanwhocodes/module-importer" "^1.0.1" "@humanwhocodes/module-importer" "^1.0.1"
"@nodelib/fs.walk" "^1.2.8" "@nodelib/fs.walk" "^1.2.8"
@ -2619,10 +2619,10 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^3.0.0: prettier@^3.1.0:
version "3.0.3" version "3.1.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==
pretty-format@^29.0.0, pretty-format@^29.7.0: pretty-format@^29.0.0, pretty-format@^29.7.0:
version "29.7.0" version "29.7.0"
@ -2952,10 +2952,10 @@ type-fest@^0.21.3:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
typescript@^5.0.4: typescript@^5.3.2:
version "5.2.2" version "5.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==
undici-types@~5.26.4: undici-types@~5.26.4:
version "5.26.5" version "5.26.5"

View file

@ -49,6 +49,7 @@ use url::Url;
const FETCH_LIMIT_DEFAULT: i64 = 10; const FETCH_LIMIT_DEFAULT: i64 = 10;
pub const FETCH_LIMIT_MAX: i64 = 50; pub const FETCH_LIMIT_MAX: i64 = 50;
const POOL_TIMEOUT: Option<Duration> = Some(Duration::from_secs(5)); const POOL_TIMEOUT: Option<Duration> = Some(Duration::from_secs(5));
pub const RANK_DEFAULT: f64 = 0.0001;
pub type ActualDbPool = Pool<AsyncPgConnection>; pub type ActualDbPool = Pool<AsyncPgConnection>;

View file

@ -230,7 +230,7 @@ mod tests {
post::{Post, PostInsertForm}, post::{Post, PostInsertForm},
}, },
traits::{Crud, Joinable, Reportable}, traits::{Crud, Joinable, Reportable},
utils::build_db_pool_for_tests, utils::{build_db_pool_for_tests, RANK_DEFAULT},
}; };
use serial_test::serial; use serial_test::serial;
@ -431,7 +431,7 @@ mod tests {
downvotes: 0, downvotes: 0,
published: agg.published, published: agg.published,
child_count: 0, child_count: 0,
hot_rank: 0.1728, hot_rank: RANK_DEFAULT,
controversy_rank: 0.0, controversy_rank: 0.0,
}, },
my_vote: None, my_vote: None,

View file

@ -410,7 +410,7 @@ mod tests {
post::{Post, PostInsertForm}, post::{Post, PostInsertForm},
}, },
traits::{Blockable, Crud, Joinable, Likeable}, traits::{Blockable, Crud, Joinable, Likeable},
utils::build_db_pool_for_tests, utils::{build_db_pool_for_tests, RANK_DEFAULT},
SubscribedType, SubscribedType,
}; };
use serial_test::serial; use serial_test::serial;
@ -1044,7 +1044,7 @@ mod tests {
downvotes: 0, downvotes: 0,
published: agg.published, published: agg.published,
child_count: 5, child_count: 5,
hot_rank: 0.1728, hot_rank: RANK_DEFAULT,
controversy_rank: 0.0, controversy_rank: 0.0,
}, },
} }

View file

@ -753,7 +753,7 @@ mod tests {
post::{Post, PostInsertForm, PostLike, PostLikeForm, PostUpdateForm}, post::{Post, PostInsertForm, PostLike, PostLikeForm, PostUpdateForm},
}, },
traits::{Blockable, Crud, Joinable, Likeable}, traits::{Blockable, Crud, Joinable, Likeable},
utils::{build_db_pool_for_tests, DbPool}, utils::{build_db_pool_for_tests, DbPool, RANK_DEFAULT},
SortType, SortType,
SubscribedType, SubscribedType,
}; };
@ -1533,10 +1533,10 @@ mod tests {
newest_comment_time: inserted_post.published, newest_comment_time: inserted_post.published,
featured_community: false, featured_community: false,
featured_local: false, featured_local: false,
hot_rank: 0.1728, hot_rank: RANK_DEFAULT,
hot_rank_active: 0.1728, hot_rank_active: RANK_DEFAULT,
controversy_rank: 0.0, controversy_rank: 0.0,
scaled_rank: 0.3621, scaled_rank: RANK_DEFAULT,
community_id: inserted_post.community_id, community_id: inserted_post.community_id,
creator_id: inserted_post.creator_id, creator_id: inserted_post.creator_id,
instance_id: data.inserted_instance.id, instance_id: data.inserted_instance.id,

View file

@ -0,0 +1,11 @@
ALTER TABLE community_aggregates
ALTER COLUMN hot_rank SET DEFAULT 0.1728;
ALTER TABLE comment_aggregates
ALTER COLUMN hot_rank SET DEFAULT 0.1728;
ALTER TABLE post_aggregates
ALTER COLUMN hot_rank SET DEFAULT 0.1728,
ALTER COLUMN hot_rank_active SET DEFAULT 0.1728,
ALTER COLUMN scaled_rank SET DEFAULT 0.3621;

View file

@ -0,0 +1,16 @@
-- Change the hot_ranks to a miniscule number, so that new / fetched content
-- won't crowd out existing content.
--
-- They must be non-zero, in order for them to be picked up by the hot_ranks updater.
-- See https://github.com/LemmyNet/lemmy/issues/4178
ALTER TABLE community_aggregates
ALTER COLUMN hot_rank SET DEFAULT 0.0001;
ALTER TABLE comment_aggregates
ALTER COLUMN hot_rank SET DEFAULT 0.0001;
ALTER TABLE post_aggregates
ALTER COLUMN hot_rank SET DEFAULT 0.0001,
ALTER COLUMN hot_rank_active SET DEFAULT 0.0001,
ALTER COLUMN scaled_rank SET DEFAULT 0.0001;