Skip to content

Commit 037eba0

Browse files
committed
Merge branch 'release/v0.11.12'
2 parents a4455db + fafb720 commit 037eba0

File tree

15 files changed

+46
-39
lines changed

15 files changed

+46
-39
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [[0.11.12]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.12) - 2023-12-20
10+
### Fixed
11+
- [530](https://github.com/thoth-pub/thoth/pull/530) - Fix pagination offset calculation in export API
12+
- [530](https://github.com/thoth-pub/thoth/pull/530) - Do not allow to create more than one price in the same currency for the same publication
13+
914
## [[0.11.11]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.11) - 2023-12-19
1015
### Changed
1116
- Upgrade rust to `1.74.1` in production and development `Dockerfile`

Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
1616
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]
1717

1818
[dependencies]
19-
thoth-api = { version = "0.11.11", path = "thoth-api", features = ["backend"] }
20-
thoth-api-server = { version = "0.11.11", path = "thoth-api-server" }
21-
thoth-app-server = { version = "0.11.11", path = "thoth-app-server" }
22-
thoth-errors = { version = "0.11.11", path = "thoth-errors" }
23-
thoth-export-server = { version = "0.11.11", path = "thoth-export-server" }
19+
thoth-api = { version = "0.11.12", path = "thoth-api", features = ["backend"] }
20+
thoth-api-server = { version = "0.11.12", path = "thoth-api-server" }
21+
thoth-app-server = { version = "0.11.12", path = "thoth-app-server" }
22+
thoth-errors = { version = "0.11.12", path = "thoth-errors" }
23+
thoth-export-server = { version = "0.11.12", path = "thoth-export-server" }
2424
clap = { version = "4.4.7", features = ["cargo", "env"] }
2525
dialoguer = { version = "0.11.0", features = ["password"] }
2626
dotenv = "0.15.0"

thoth-api-server/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api-server"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "0.11.11", path = "../thoth-api", features = ["backend"] }
13-
thoth-errors = { version = "0.11.11", path = "../thoth-errors" }
12+
thoth-api = { version = "0.11.12", path = "../thoth-api", features = ["backend"] }
13+
thoth-errors = { version = "0.11.12", path = "../thoth-errors" }
1414
actix-web = "4.4.0"
1515
actix-cors = "0.6.4"
1616
actix-identity = "0.6.0"

thoth-api/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
1616
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web"]
1717

1818
[dependencies]
19-
thoth-errors = { version = "0.11.11", path = "../thoth-errors" }
19+
thoth-errors = { version = "0.11.12", path = "../thoth-errors" }
2020
actix-web = { version = "4.4.0", optional = true }
2121
argon2rs = "0.2.5"
2222
isbn2 = "0.4.0"
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE price DROP CONSTRAINT price_publication_id_currency_code_uniq;

thoth-api/migrations/v0.11.12/up.sql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE price ADD CONSTRAINT price_publication_id_currency_code_uniq
2+
UNIQUE (publication_id, currency_code);

thoth-app-server/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-app-server"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"

thoth-app/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-app"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -41,5 +41,5 @@ uuid = { version = "0.8.2", features = ["serde", "v4"] }
4141
# `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm
4242
# https://docs.rs/getrandom/latest/getrandom/#webassembly-support
4343
getrandom = { version = "0.2", features = ["js"] }
44-
thoth-api = { version = "0.11.11", path = "../thoth-api" }
45-
thoth-errors = { version = "0.11.11", path = "../thoth-errors" }
44+
thoth-api = { version = "0.11.12", path = "../thoth-api" }
45+
thoth-errors = { version = "0.11.12", path = "../thoth-errors" }

thoth-app/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start_url": "/?homescreen=1",
1010
"background_color": "#ffffff",
1111
"theme_color": "#ffdd57",
12-
"version": "0.11.11",
12+
"version": "0.11.12",
1313
"icons": [
1414
{
1515
"src": "\/android-icon-36x36.png",

thoth-client/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-client"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = {version = "0.11.11", path = "../thoth-api" }
13-
thoth-errors = {version = "0.11.11", path = "../thoth-errors" }
12+
thoth-api = {version = "0.11.12", path = "../thoth-api" }
13+
thoth-errors = {version = "0.11.12", path = "../thoth-errors" }
1414
graphql_client = "0.13.0"
1515
chrono = { version = "0.4.31", features = ["serde"] }
1616
reqwest = { version = "0.11", features = ["json"] }

thoth-errors/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-errors"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"

thoth-errors/src/database_errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static DATABASE_CONSTRAINT_ERRORS: Map<&'static str, &'static str> = phf_map! {
6262
"location_uniq_platform_idx" => "A location on the selected platform already exists.",
6363
"location_url_check" => "A location must have a landing page and/or a full text URL.",
6464
"orcid_uniq_idx" => "A contributor with this ORCID ID already exists.",
65+
"price_publication_id_currency_code_uniq" => "A price in this currency already exists for this publication.",
6566
"price_unit_price_check" => "Price values must be greater than zero. To indicate an unpriced Publication, omit all Prices.",
6667
"publication_depth_in_check" => "Publication depth must be greater than 0.0.",
6768
"publication_depth_in_not_missing" => "When specifying Depth, both values (mm and in) must be supplied.",

thoth-export-server/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-export-server"
3-
version = "0.11.11"
3+
version = "0.11.12"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -9,9 +9,9 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "0.11.11", path = "../thoth-api" }
13-
thoth-errors = { version = "0.11.11", path = "../thoth-errors" }
14-
thoth-client = { version = "0.11.11", path = "../thoth-client" }
12+
thoth-api = { version = "0.11.12", path = "../thoth-api" }
13+
thoth-errors = { version = "0.11.12", path = "../thoth-errors" }
14+
thoth-client = { version = "0.11.12", path = "../thoth-client" }
1515
actix-web = "4.4.0"
1616
actix-cors = "0.6.4"
1717
cc_license = "0.1.0"

thoth-export-server/src/specification_query.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ impl SpecificationQuery {
5151
.thoth_client
5252
.get_work_count(Some(vec![publisher_id]))
5353
.await?;
54-
let total_pages = (work_count / PAGINATION_LIMIT) + 1;
54+
// calculate total pages, rounding up to ensure all works are covered
55+
let total_pages = (work_count + PAGINATION_LIMIT - 1) / PAGINATION_LIMIT;
5556
// get a vector of all page offsets we will need
56-
let offsets = match total_pages {
57-
1 => vec![0], // otherwise a range of (1..1) gives us nothing
58-
_ => (1..total_pages)
59-
.map(|current_page| (current_page - 1) * PAGINATION_LIMIT)
60-
.collect::<Vec<i64>>(),
61-
};
57+
let offsets = (1..=total_pages) // inclusive upper bound
58+
.map(|current_page| (current_page - 1) * PAGINATION_LIMIT)
59+
.collect::<Vec<i64>>();
6260

6361
// make concurrent requests iterating the list of offsets to asynchronously obtain all pages
6462
let mut works_pages = stream::iter(offsets)

0 commit comments

Comments
 (0)