Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: calculation UI refresh (#6615)

Nathan.fooo171c5634f2da
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock
index 1f606efb14..ad7462c11c 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock
@@ -1031,7 +1031,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1056,7 +1056,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-trait",
@@ -1070,6 +1070,7 @@ dependencies = [
"fancy-regex 0.13.0",
"futures",
"getrandom 0.2.10",
+ "iana-time-zone",
"js-sys",
"lazy_static",
"nanoid",
@@ -1095,7 +1096,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1116,7 +1117,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"bytes",
@@ -1136,7 +1137,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1158,7 +1159,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-recursion",
@@ -1219,7 +1220,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-stream",
@@ -1299,7 +1300,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"collab",
@@ -3563,16 +3564,16 @@ dependencies = [
[[package]]
name = "iana-time-zone"
-version = "0.1.57"
+version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
+checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
- "windows 0.48.0",
+ "windows-core",
]
[[package]]
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml
index a6c36e1176..982c06a2e9 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml
@@ -120,14 +120,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
# Working directory: frontend
# To update the commit ID, run:
diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.lock b/frontend/appflowy_web_app/src-tauri/Cargo.lock
index 0e2e66d830..ed8976cffe 100644
--- a/frontend/appflowy_web_app/src-tauri/Cargo.lock
+++ b/frontend/appflowy_web_app/src-tauri/Cargo.lock
@@ -1029,7 +1029,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1054,7 +1054,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-trait",
@@ -1068,6 +1068,7 @@ dependencies = [
"fancy-regex 0.13.0",
"futures",
"getrandom 0.2.12",
+ "iana-time-zone",
"js-sys",
"lazy_static",
"nanoid",
@@ -1093,7 +1094,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1114,7 +1115,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"bytes",
@@ -1134,7 +1135,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1156,7 +1157,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-recursion",
@@ -1217,7 +1218,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-stream",
@@ -1297,7 +1298,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"collab",
@@ -3650,9 +3651,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
-version = "0.1.60"
+version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
+checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
dependencies = [
"android_system_properties",
"core-foundation-sys",
diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.toml
index e15f726b57..da3ac7fd72 100644
--- a/frontend/appflowy_web_app/src-tauri/Cargo.toml
+++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml
@@ -118,14 +118,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
# Working directory: frontend
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 46e172c6c4..7be5520f1c 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -267,9 +267,9 @@ dependencies = [
[[package]]
name = "async-compression"
-version = "0.4.16"
+version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "103db485efc3e41214fe4fda9f3dbeae2eb9082f48fd236e6095627a9422066e"
+checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857"
dependencies = [
"bzip2",
"deflate64",
@@ -892,7 +892,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -917,7 +917,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-trait",
@@ -931,6 +931,7 @@ dependencies = [
"fancy-regex 0.13.0",
"futures",
"getrandom 0.2.10",
+ "iana-time-zone",
"js-sys",
"lazy_static",
"nanoid",
@@ -956,7 +957,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -977,7 +978,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"bytes",
@@ -997,7 +998,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"arc-swap",
@@ -1019,7 +1020,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-recursion",
@@ -1080,7 +1081,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"async-stream",
@@ -1160,7 +1161,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=79bc18e4651c17c83d9f00a5ce79423398e88ea1#79bc18e4651c17c83d9f00a5ce79423398e88ea1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=dd8a1d13e97322338f027888a71340575cd9ad8f#dd8a1d13e97322338f027888a71340575cd9ad8f"
dependencies = [
"anyhow",
"collab",
@@ -3240,16 +3241,16 @@ dependencies = [
[[package]]
name = "iana-time-zone"
-version = "0.1.57"
+version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
+checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
- "windows 0.48.0",
+ "windows-core",
]
[[package]]
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index 637636eaef..96cc79ece2 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -143,14 +143,14 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
-collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
+collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "dd8a1d13e97322338f027888a71340575cd9ad8f" }
# Working directory: frontend
# To update the commit ID, run:
diff --git a/frontend/rust-lib/event-integration-test/src/database_event.rs b/frontend/rust-lib/event-integration-test/src/database_event.rs
index c9504f2ac0..fa195863a1 100644
--- a/frontend/rust-lib/event-integration-test/src/database_event.rs
+++ b/frontend/rust-lib/event-integration-test/src/database_event.rs
@@ -56,14 +56,15 @@ impl EventIntegrationTest {
.parse::<ViewPB>()
}
- pub async fn open_database(&self, view_id: &str) {
+ pub async fn open_database(&self, view_id: &str) -> DatabasePB {
EventBuilder::new(self.clone())
.event(DatabaseEvent::GetDatabase)
.payload(DatabaseViewIdPB {
value: view_id.to_string(),
})
.async_send()
- .await;
+ .await
+ .parse::<DatabasePB>()
}
pub async fn create_board(&self, parent_id: &str, name: String, initial_data: Vec<u8>) -> ViewPB {
@@ -171,6 +172,41 @@ impl EventIntegrationTest {
.error()
}
+ pub async fn remove_calculate(
+ &self,
+ changeset: RemoveCalculationChangesetPB,
+ ) -> Option<FlowyError> {
+ EventBuilder::new(self.clone())
+ .event(DatabaseEvent::RemoveCalculation)
+ .payload(changeset)
+ .async_send()
+ .await
+ .error()
+ }
+
+ pub async fn get_all_calculations(&self, database_view_id: &str) -> RepeatedCalculationsPB {
+ EventBuilder::new(self.clone())
+ .event(DatabaseEvent::GetAllCalculations)
+ .payload(DatabaseViewIdPB {
+ value: database_view_id.to_string(),
+ })
+ .async_send()
+ .await
+ .parse::<RepeatedCalculationsPB>()
+ }
+
+ pub async fn update_calculation(
+ &self,
+ changeset: UpdateCalculationChangesetPB,
+ ) -> Option<FlowyError> {
+ EventBuilder::new(self.clone())
+ .event(DatabaseEvent::UpdateCalculation)
+ .payload(changeset)
+ .async_send()
+ .await
+ .error()
+ }
+
pub async fn update_field_type(
&self,
view_id: &str,
diff --git a/frontend/rust-lib/event-integration-test/tests/asset/project.csv b/frontend/rust-lib/event-integration-test/tests/asset/project.csv
new file mode 100644
index 0000000000..7f55c29797
--- /dev/null
+++ b/frontend/rust-lib/event-integration-test/tests/asset/project.csv
@@ -0,0 +1,5 @@
+Project name,Status,Owner,Dates,Priority,Completion,Tasks,Blocked By,Is Blocking,Summary,Delay,Checkbox,Files & media
+Research study,In Progress,Nate Martins,"April 23, 2024 → May 22, 2024",High,0.25,"Develop survey questions (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Develop%20survey%20questions%2086ce25c6bb214b4b9e35beed8bc8b821.md), Interpret findings (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Interpret%20findings%20c418ae6385f94dcdadca1423ad60146b.md), Write research report (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Write%20research%20report%20cca8f4321cd44dceba9c266cdf544f15.md), Conduct interviews (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Conduct%20interviews%208f40c17883904d769fee19baeb0d46a5.md)",,Marketing campaign (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Projects%2058b8977d6e4444a98ec4d64176a071e5/Marketing%20campaign%2088ac0cea4cb245efb44d63ace0a37d1e.md),"A research study is underway to understand customer satisfaction and identify improvement areas. The team is developing a survey to gather data from customers, aiming to analyze insights for strategic decision-making and enhance satisfaction.",7,No,Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/DO010003572.jpeg
+Marketing campaign,In Progress,Sohrab Amin,"April 24, 2024 → May 7, 2024",Low,0.5,"Define target audience (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Define%20target%20audience%2045e2d3342bfe44848009f8e19e65b2af.md), Develop advertising plan (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Develop%20advertising%20plan%20a8e534ad763040029d0feb27fdb1820d.md), Report on marketing ROI (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Report%20on%20marketing%20ROI%202458b6a0f0174f72af3e5daac8b36b08.md), Create social media plan (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Create%20social%20media%20plan%204e70ea0b7d40427a9648bcf554a121f6.md), Create performance marketing plan (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Create%20performance%20marketing%20plan%20b6aa6a9e9cc1446490984eaecc4930c7.md), Develop new creative assets (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Develop%20new%20creative%20assets%203268a1d63424427ba1f7e3cac109cefa.md)",Research study (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Projects%2058b8977d6e4444a98ec4d64176a071e5/Research%20study%20e445ee1fb7ff4591be2de17d906df97e.md),Website redesign (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Projects%2058b8977d6e4444a98ec4d64176a071e5/Website%20redesign%20bb934cb9f0e44daab4368247d62b0f39.md),"The marketing campaign, led by Sohrab Amin, focuses on enhancing mobile performance, building on last year's success in reducing page load times by 50%. The team aims to further improve performance by investing in native components for iOS and Android from April 24 to May 7, 2024.",19,No,Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/appflowy_2x.png
+Website redesign,Planning,Nate Martins,"May 10, 2024 → May 26, 2024",Medium,,"Conduct website audit (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Conduct%20website%20audit%20aee812f0c962462e8b91e8044a268eb5.md), Write website copy (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Write%20website%20copy%209ab9309ceae34f6f8dc19b2eeda8f8f2.md), Test website functionality (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Test%20website%20functionality%208ccf7153028747b19a351f6d36100f0d.md), Develop creative assets (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Develop%20creative%20assets%206fe86230e30843ebb60c67724f0f922f.md)",Marketing campaign (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Projects%2058b8977d6e4444a98ec4d64176a071e5/Marketing%20campaign%2088ac0cea4cb245efb44d63ace0a37d1e.md),,"The website redesign project, led by Nate Martins from May 10 to May 26, 2024, aims to create a more effective onboarding process to enhance user experience and increase 7-day retention by 25%.",,Yes,
+Product launch,In Progress,Ben Lang,"May 8, 2024 → May 22, 2024",High,0.6666666666666666,"Create product demo video (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Create%20product%20demo%20video%202e2e2eb53df84019a613fe386e4c79da.md), Create product positioning (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Create%20product%20positioning%20c0d2728f79594cc3a1869a3c67bcdf45.md), Monitor launch performance (Projects%20&%20Tasks%20104d4deadd2c805fb3abcaab6d3727e7/Tasks%2076aaf8a4637542ed8175259692ca08bb/Monitor%20launch%20performance%207c0b846d1da2463892eff490f06e0d0b.md)",,,"A new product launch is scheduled from May 8 to May 22, 2024, initiated to fill a market gap and expand the product line. The development team is focused on creating a high-quality product, while the marketing team is crafting a strategy to achieve a 10% market share within the first six months post-launch.",16,Yes,
\ No newline at end of file
diff --git a/frontend/rust-lib/event-integration-test/tests/database/local_test/calculate_test.rs b/frontend/rust-lib/event-integration-test/tests/database/local_test/calculate_test.rs
index 8b13789179..7412f54951 100644
--- a/frontend/rust-lib/event-integration-test/tests/database/local_test/calculate_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/database/local_test/calculate_test.rs
@@ -1 +1,90 @@
+use std::time::Duration;
+use crate::util::gen_csv_import_data;
+use event_integration_test::EventIntegrationTest;
+use flowy_database2::entities::{
+ CalculationType, CellChangesetPB, DatabasePB, RemoveCalculationChangesetPB,
+ UpdateCalculationChangesetPB,
+};
+use tokio::time::sleep;
+
+#[tokio::test]
+async fn calculation_integration_test1() {
+ let test = EventIntegrationTest::new().await;
+ test.sign_up_as_anon().await;
+
+ let workspace_id = test.get_current_workspace().await.id;
+ let payload = gen_csv_import_data("project.csv", &workspace_id);
+ let view = test.import_data(payload).await.pop().unwrap();
+ let database = test.open_database(&view.id).await;
+
+ average_calculation(test, database, &view.id).await;
+}
+
+// Tests for the CalculationType::Average
+// Is done on the Delay column in the project.csv
+async fn average_calculation(
+ test: EventIntegrationTest,
+ database: DatabasePB,
+ database_view_id: &str,
+) {
+ // Delay column is the 11th column (index 10) in the project.csv
+ let delay_field = database.fields.get(10).unwrap();
+
+ let calculation_changeset = UpdateCalculationChangesetPB {
+ view_id: database_view_id.to_string(),
+ calculation_id: None,
+ field_id: delay_field.field_id.clone(),
+ calculation_type: CalculationType::Average,
+ };
+
+ test.update_calculation(calculation_changeset).await;
+
+ // Wait for calculation update
+ sleep(Duration::from_secs(1)).await;
+
+ let all_calculations = test.get_all_calculations(database_view_id).await;
+ assert!(all_calculations.items.len() == 1);
+
+ let average_calc = all_calculations.items.first().unwrap();
+ assert!(
+ average_calc.value == "14.00",
+ "Expected 14.00, got {}",
+ average_calc.value
+ );
+
+ // Update a cell in the delay column at fourth row (3rd index)
+ let cell_changeset = CellChangesetPB {
+ view_id: database_view_id.to_string(),
+ row_id: database.rows.get(3).unwrap().id.clone(),
+ field_id: delay_field.field_id.clone(),
+ cell_changeset: "22".to_string(),
+ };
+ test.update_cell(cell_changeset).await;
+
+ // wait for awhile because the calculate is done in the background
+ tokio::time::sleep(Duration::from_secs(6)).await;
+
+ let all_calculations = test.get_all_calculations(database_view_id).await;
+ assert!(
+ all_calculations.items.len() == 1,
+ "Expected 1, got {}",
+ all_calculations.items.len()
+ );
+
+ let average_calc = all_calculations.items.first().unwrap();
+ assert!(
+ average_calc.value == "16.00",
+ "Expected 16.00, got {}",
+ average_calc.value
+ );
+
+ // Remove the calculation
+ test
+ .remove_calculate(RemoveCalculationChangesetPB {
+ view_id: database_view_id.to_string(),
+ field_id: delay_field.field_id.clone(),
+ calculation_id: average_calc.id.clone(),
+ })
+ .await;
+}
diff --git a/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs b/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs
index 42593c3e5b..fb0417bdd0 100644
--- a/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs
@@ -42,7 +42,7 @@ async fn af_cloud_edit_document_test() {
#[tokio::test]
async fn af_cloud_sync_anon_user_document_test() {
- let (cleaner, user_db_path) = unzip("./tests/asset", "040_sync_local_document").unwrap();
+ let user_db_path = unzip("./tests/asset", "040_sync_local_document").unwrap();
use_localhost_af_cloud().await;
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path.clone(), DEFAULT_NAME.to_string())
@@ -77,8 +77,6 @@ async fn af_cloud_sync_anon_user_document_test() {
&document_id,
expected_040_sync_local_document_data(),
);
-
- drop(cleaner);
}
fn expected_040_sync_local_document_data() -> DocumentData {
diff --git a/frontend/rust-lib/event-integration-test/tests/folder/local_test/import_test.rs b/frontend/rust-lib/event-integration-test/tests/folder/local_test/import_test.rs
index be31ecdaf3..28a7fdffa5 100644
--- a/frontend/rust-lib/event-integration-test/tests/folder/local_test/import_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/folder/local_test/import_test.rs
@@ -7,7 +7,7 @@ use flowy_folder::entities::{ImportItemPayloadPB, ImportPayloadPB, ImportTypePB,
async fn import_492_row_csv_file_test() {
// csv_500r_15c.csv is a file with 492 rows and 17 columns
let file_name = "csv_492r_17c.csv".to_string();
- let (cleaner, csv_file_path) = unzip("./tests/asset", &file_name).unwrap();
+ let csv_file_path = unzip("./tests/asset", &file_name).unwrap();
let csv_string = std::fs::read_to_string(csv_file_path).unwrap();
let test = EventIntegrationTest::new_with_name(DEFAULT_NAME).await;
@@ -20,14 +20,13 @@ async fn import_492_row_csv_file_test() {
let view_id = views[0].clone().id;
let database = test.get_database(&view_id).await;
assert_eq!(database.rows.len(), 492);
- drop(cleaner);
}
#[tokio::test]
async fn import_10240_row_csv_file_test() {
// csv_22577r_15c.csv is a file with 10240 rows and 15 columns
let file_name = "csv_10240r_15c.csv".to_string();
- let (cleaner, csv_file_path) = unzip("./tests/asset", &file_name).unwrap();
+ let csv_file_path = unzip("./tests/asset", &file_name).unwrap();
let csv_string = std::fs::read_to_string(csv_file_path).unwrap();
let test = EventIntegrationTest::new_with_name(DEFAULT_NAME).await;
@@ -40,8 +39,6 @@ async fn import_10240_row_csv_file_test() {
let view_id = views[0].clone().id;
let database = test.get_database(&view_id).await;
assert_eq!(database.rows.len(), 10240);
-
- drop(cleaner);
}
fn gen_import_data(file_name: String, csv_string: String, workspace_id: String) -> ImportPayloadPB {
diff --git a/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_database_test.rs b/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_database_test.rs
index 6594fd83fc..2754c027d7 100644
--- a/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_database_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_database_test.rs
@@ -121,23 +121,21 @@ async fn test_publish_encode_collab_result(
}
async fn import_workspace(file_name: &str, test: &EventIntegrationTest) -> Vec<ViewPB> {
- let (cleaner, file_path) = unzip("./tests/asset", file_name).unwrap();
+ let file_path = unzip("./tests/asset", file_name).unwrap();
test
.import_appflowy_data(file_path.to_str().unwrap().to_string(), None)
.await
.unwrap();
- let views = test.get_all_workspace_views().await;
- drop(cleaner);
- views
+
+ test.get_all_workspace_views().await
}
async fn import_csv(file_name: &str, test: &EventIntegrationTest) -> ViewPB {
- let (cleaner, file_path) = unzip("./tests/asset", file_name).unwrap();
+ let file_path = unzip("./tests/asset", file_name).unwrap();
let csv_string = std::fs::read_to_string(file_path).unwrap();
let workspace_id = test.get_current_workspace().await.id;
let import_data = gen_import_data(file_name.to_string(), csv_string, workspace_id);
let views = test.import_data(import_data).await;
- drop(cleaner);
views[0].clone()
}
diff --git a/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/anon_user_test.rs b/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/anon_user_test.rs
index 0840bdec15..718bc1d9af 100644
--- a/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/anon_user_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/anon_user_test.rs
@@ -7,7 +7,7 @@ use crate::util::unzip;
#[tokio::test]
async fn reading_039_anon_user_data_test() {
- let (cleaner, user_db_path) = unzip("./tests/asset", "039_local").unwrap();
+ let user_db_path = unzip("./tests/asset", "039_local").unwrap();
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;
let first_level_views = test.get_all_workspace_views().await;
@@ -36,13 +36,11 @@ async fn reading_039_anon_user_data_test() {
let trash_items = test.get_trash().await.items;
assert_eq!(trash_items.len(), 1);
-
- drop(cleaner);
}
#[tokio::test]
async fn migrate_anon_user_data_to_af_cloud_test() {
- let (cleaner, user_db_path) = unzip("./tests/asset", "040_local").unwrap();
+ let user_db_path = unzip("./tests/asset", "040_local").unwrap();
// In the 040_local, the structure is:
// workspace:
// view: Document1
@@ -113,6 +111,4 @@ async fn migrate_anon_user_data_to_af_cloud_test() {
assert_eq!(anon_third_level_views.len(), 2);
assert_eq!(user_third_level_views[0].name, "Grid1".to_string());
assert_eq!(user_third_level_views[1].name, "Grid2".to_string());
-
- drop(cleaner);
}
diff --git a/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/import_af_data_folder_test.rs b/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/import_af_data_folder_test.rs
index 87b2679da8..cc02bb1f2e 100644
--- a/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/import_af_data_folder_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/import_af_data_folder_test.rs
@@ -17,7 +17,7 @@ use std::env::temp_dir;
#[tokio::test]
async fn import_appflowy_data_with_ref_views_test() {
let import_container_name = "data_ref_doc".to_string();
- let (_cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
+ let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
use_localhost_af_cloud().await;
let test = EventIntegrationTest::new_with_name(DEFAULT_NAME).await;
let _ = test.af_cloud_sign_up().await;
@@ -98,7 +98,7 @@ async fn import_appflowy_data_with_ref_views_test() {
#[tokio::test]
async fn import_appflowy_data_folder_into_new_view_test() {
let import_container_name = "040_local".to_string();
- let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
+ let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
// In the 040_local, the structure is:
// Document1
// Document2
@@ -173,13 +173,12 @@ async fn import_appflowy_data_folder_into_new_view_test() {
let row_document_data = test.get_document_data(&row_document_id).await;
assert_json_include!(actual: json!(row_document_data), expected: expected_row_doc_json());
- drop(cleaner);
}
#[tokio::test]
async fn import_appflowy_data_folder_into_current_workspace_test() {
let import_container_name = "040_local".to_string();
- let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
+ let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
// In the 040_local, the structure is:
// Document1
// Document2
@@ -224,8 +223,6 @@ async fn import_appflowy_data_folder_into_current_workspace_test() {
assert_eq!(document2_child_views.len(), 2);
assert_eq!(document2_child_views[0].name, "Grid1");
assert_eq!(document2_child_views[1].name, "Grid2");
-
- drop(cleaner);
}
#[tokio::test]
@@ -247,7 +244,7 @@ async fn import_empty_appflowy_data_folder_test() {
#[tokio::test]
async fn import_appflowy_data_folder_multiple_times_test() {
let import_container_name = "040_local_2".to_string();
- let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
+ let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
// In the 040_local_2, the structure is:
// Getting Started
// Doc1
@@ -313,7 +310,6 @@ async fn import_appflowy_data_folder_multiple_times_test() {
for view in shared_space_children_views {
assert_040_local_2_import_content(&test, &view.id).await;
}
- drop(cleaner);
}
async fn assert_040_local_2_import_content(test: &EventIntegrationTest, view_id: &str) {
diff --git a/frontend/rust-lib/event-integration-test/tests/user/local_test/import_af_data_local_test.rs b/frontend/rust-lib/event-integration-test/tests/user/local_test/import_af_data_local_test.rs
index fe0c8b8341..4f1ea45fee 100644
--- a/frontend/rust-lib/event-integration-test/tests/user/local_test/import_af_data_local_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/user/local_test/import_af_data_local_test.rs
@@ -7,9 +7,8 @@ use std::time::Duration;
#[tokio::test]
async fn import_appflowy_data_folder_into_new_view_test() {
let import_container_name = "040_local".to_string();
- let (cleaner, user_db_path) = unzip("./tests/asset", &import_container_name).unwrap();
- let (imported_af_folder_cleaner, imported_af_data_path) =
- unzip("./tests/asset", &import_container_name).unwrap();
+ let user_db_path = unzip("./tests/asset", &import_container_name).unwrap();
+ let imported_af_data_path = unzip("./tests/asset", &import_container_name).unwrap();
use_localhost_af_cloud().await;
let test =
@@ -50,7 +49,4 @@ async fn import_appflowy_data_folder_into_new_view_test() {
assert_eq!(view.name, import_container_name);
}
}
-
- drop(cleaner);
- drop(imported_af_folder_cleaner);
}
diff --git a/frontend/rust-lib/event-integration-test/tests/user/migration_test/document_test.rs b/frontend/rust-lib/event-integration-test/tests/user/migration_test/document_test.rs
index 6b16407dec..f4ba5ec831 100644
--- a/frontend/rust-lib/event-integration-test/tests/user/migration_test/document_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/user/migration_test/document_test.rs
@@ -6,7 +6,7 @@ use crate::util::unzip;
#[tokio::test]
async fn migrate_historical_empty_document_test() {
- let (cleaner, user_db_path) = unzip(
+ let user_db_path = unzip(
"./tests/user/migration_test/history_user_db",
"historical_empty_document",
)
@@ -23,6 +23,4 @@ async fn migrate_historical_empty_document_test() {
assert_eq!(data.blocks.len(), 2);
assert!(!data.meta.children_map.is_empty());
}
-
- drop(cleaner);
}
diff --git a/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs b/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs
index 5edbb64caf..5a75197a9c 100644
--- a/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs
@@ -7,7 +7,7 @@ use crate::util::unzip;
#[tokio::test]
async fn migrate_020_historical_empty_document_test() {
- let (cleaner, user_db_path) = unzip(
+ let user_db_path = unzip(
"./tests/user/migration_test/history_user_db",
"020_historical_user_data",
)
@@ -37,13 +37,12 @@ async fn migrate_020_historical_empty_document_test() {
let database = test.get_database(&child_views[1].id).await;
assert_eq!(database.fields.len(), 8);
assert_eq!(database.rows.len(), 3);
- drop(cleaner);
}
#[tokio::test]
async fn migrate_036_fav_v1_workspace_array_test() {
// Used to test migration: FavoriteV1AndWorkspaceArrayMigration
- let (cleaner, user_db_path) = unzip(
+ let user_db_path = unzip(
"./tests/user/migration_test/history_user_db",
"036_fav_v1_workspace_array",
)
@@ -59,13 +58,12 @@ async fn migrate_036_fav_v1_workspace_array_test() {
let views = test.get_view(&views[1].id).await;
assert_eq!(views.child_views.len(), 3);
assert!(views.child_views[2].is_favorite);
- drop(cleaner);
}
#[tokio::test]
async fn migrate_038_trash_test() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
- let (cleaner, user_db_path) = unzip("./tests/asset", "038_local").unwrap();
+ let user_db_path = unzip("./tests/asset", "038_local").unwrap();
// Getting started
// Document1
// Document2(deleted)
@@ -95,14 +93,12 @@ async fn migrate_038_trash_test() {
assert_eq!(trash_items[0].name, "Document3");
assert_eq!(trash_items[1].name, "Document2");
assert_eq!(trash_items[2].name, "Document4");
-
- drop(cleaner);
}
#[tokio::test]
async fn migrate_038_trash_test2() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
- let (cleaner, user_db_path) = unzip("./tests/asset", "038_document_with_grid").unwrap();
+ let user_db_path = unzip("./tests/asset", "038_document_with_grid").unwrap();
// Getting started
// document
// grid
@@ -123,14 +119,12 @@ async fn migrate_038_trash_test2() {
let views = test.get_view(&views[0].id).await.child_views;
assert_eq!(views[0].name, "board");
-
- drop(cleaner);
}
#[tokio::test]
async fn collab_db_backup_test() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
- let (cleaner, user_db_path) = unzip("./tests/asset", "038_local").unwrap();
+ let user_db_path = unzip("./tests/asset", "038_local").unwrap();
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;
@@ -145,13 +139,12 @@ async fn collab_db_backup_test() {
backups[0],
format!("collab_db_{}", chrono::Local::now().format("%Y%m%d"))
);
- drop(cleaner);
}
#[tokio::test]
async fn delete_outdated_collab_db_backup_test() {
// Used to test migration: WorkspaceTrashMapToSectionMigration
- let (cleaner, user_db_path) = unzip("./tests/asset", "040_collab_backups").unwrap();
+ let user_db_path = unzip("./tests/asset", "040_collab_backups").unwrap();
let test =
EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;
@@ -179,5 +172,4 @@ async fn delete_outdated_collab_db_backup_test() {
backups[9],
format!("collab_db_{}", chrono::Local::now().format("%Y%m%d"))
);
- drop(cleaner);
}
diff --git a/frontend/rust-lib/event-integration-test/tests/util.rs b/frontend/rust-lib/event-integration-test/tests/util.rs
index aabc528fa7..2e2c2d578f 100644
--- a/frontend/rust-lib/event-integration-test/tests/util.rs
+++ b/frontend/rust-lib/event-integration-test/tests/util.rs
@@ -1,11 +1,11 @@
+use nanoid::nanoid;
+use std::env::temp_dir;
use std::fs::{create_dir_all, File, OpenOptions};
use std::io::copy;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::time::Duration;
use std::{fs, io};
-
-use nanoid::nanoid;
use tokio::sync::mpsc::Receiver;
use tokio::time::timeout;
use uuid::Uuid;
@@ -14,8 +14,9 @@ use zip::write::FileOptions;
use zip::{CompressionMethod, ZipArchive, ZipWriter};
use event_integration_test::event_builder::EventBuilder;
-use event_integration_test::Cleaner;
+
use event_integration_test::EventIntegrationTest;
+use flowy_folder::entities::{ImportItemPayloadPB, ImportPayloadPB, ImportTypePB, ViewLayoutPB};
use flowy_user::entities::UpdateUserProfilePayloadPB;
use flowy_user::errors::FlowyError;
use flowy_user::event_map::UserEvent::*;
@@ -122,26 +123,23 @@ pub fn zip(src_dir: PathBuf, output_file_path: PathBuf) -> io::Result<()> {
zip.finish()?;
Ok(())
}
-pub fn unzip_test_asset(folder_name: &str) -> io::Result<(Cleaner, PathBuf)> {
+pub fn unzip_test_asset(folder_name: &str) -> io::Result<PathBuf> {
unzip("./tests/asset", folder_name)
}
-pub fn unzip(root: &str, folder_name: &str) -> io::Result<(Cleaner, PathBuf)> {
+pub fn unzip(test_asset_dir: &str, folder_name: &str) -> io::Result<PathBuf> {
// Open the zip file
- let zip_file_path = format!("{}/{}.zip", root, folder_name);
+ let zip_file_path = format!("{}/{}.zip", test_asset_dir, folder_name);
let reader = File::open(zip_file_path)?;
- let output_folder_path = format!("{}/unit_test_{}", root, nanoid!(6));
+ // let output_folder_path = format!("{}/unit_test_{}", test_asset_dir, nanoid!(6));
+ let output_folder_path = temp_dir().join(nanoid!(6)).to_str().unwrap().to_string();
// Create a ZipArchive from the file
let mut archive = ZipArchive::new(reader)?;
-
- // Iterate through each file in the zip
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
let output_path = Path::new(&output_folder_path).join(file.mangled_name());
-
if file.name().ends_with('/') {
- // Create directory
create_dir_all(&output_path)?;
} else {
// Write file
@@ -155,12 +153,23 @@ pub fn unzip(root: &str, folder_name: &str) -> io::Result<(Cleaner, PathBuf)> {
}
}
let path = format!("{}/{}", output_folder_path, folder_name);
- Ok((
- Cleaner::new(PathBuf::from(output_folder_path)),
- PathBuf::from(path),
- ))
+ Ok(PathBuf::from(path))
}
pub fn generate_test_email() -> String {
format!("{}@test.com", Uuid::new_v4())
}
+
+pub fn gen_csv_import_data(file_name: &str, workspace_id: &str) -> ImportPayloadPB {
+ let file_path = format!("./tests/asset/{}", file_name);
+ ImportPayloadPB {
+ parent_view_id: workspace_id.to_string(),
+ items: vec![ImportItemPayloadPB {
+ name: file_name.to_string(),
+ data: None,
+ file_path: Some(file_path),
+ view_layout: ViewLayoutPB::Grid,
+ import_type: ImportTypePB::CSV,
+ }],
+ }
+}
diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs
index c9c5f8b6b6..21582adb1f 100644
--- a/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs
+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs
@@ -27,6 +27,7 @@ use flowy_user::services::data_import::{load_collab_by_object_id, load_collab_by
use lib_dispatch::prelude::ToBytes;
use std::collections::HashMap;
use std::convert::TryFrom;
+use std::path::Path;
use std::sync::{Arc, Weak};
use tokio::sync::RwLock;
@@ -513,13 +514,21 @@ impl FolderOperationHandler for DatabaseFolderOperation {
async fn import_from_file_path(
&self,
- _view_id: &str,
+ view_id: &str,
_name: &str,
path: String,
) -> Result<(), FlowyError> {
- self
+ let file_path = Path::new(&path);
+ if !file_path.exists() {
+ return Err(FlowyError::record_not_found().with_context("File not found"));
+ }
+
+ let data = tokio::fs::read(file_path).await?;
+ let content =
+ String::from_utf8(data).map_err(|e| FlowyError::invalid_data().with_context(e))?;
+ let _ = self
.0
- .import_csv_from_file(path, CSVFormat::Original)
+ .import_csv(view_id.to_string(), content, CSVFormat::Original)
.await?;
Ok(())
}
diff --git a/frontend/rust-lib/flowy-database2/src/event_handler.rs b/frontend/rust-lib/flowy-database2/src/event_handler.rs
index 0252d72be5..ed766885c7 100644
--- a/frontend/rust-lib/flowy-database2/src/event_handler.rs
+++ b/frontend/rust-lib/flowy-database2/src/event_handler.rs
@@ -1129,7 +1129,6 @@ pub(crate) async fn get_all_calculations_handler(
.await?;
let calculations = database_editor.get_all_calculations(view_id.as_ref()).await;
-
data_result_ok(calculations)
}
diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rs
index aa05fd4005..fca8db4f97 100644
--- a/frontend/rust-lib/flowy-database2/src/manager.rs
+++ b/frontend/rust-lib/flowy-database2/src/manager.rs
@@ -507,15 +507,6 @@ impl DatabaseManager {
Ok(result)
}
- // will implement soon
- pub async fn import_csv_from_file(
- &self,
- _file_path: String,
- _format: CSVFormat,
- ) -> FlowyResult<()> {
- Ok(())
- }
-
pub async fn export_csv(&self, view_id: &str, style: CSVFormat) -> FlowyResult<String> {
let database = self.get_database_editor_with_view_id(view_id).await?;
database.export_csv(style).await
diff --git a/frontend/rust-lib/flowy-database2/src/services/calculations/controller.rs b/frontend/rust-lib/flowy-database2/src/services/calculations/controller.rs
index 0ff938cd6e..4e114261f8 100644
--- a/frontend/rust-lib/flowy-database2/src/services/calculations/controller.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/calculations/controller.rs
@@ -9,7 +9,7 @@ use flowy_error::FlowyResult;
use lib_infra::priority_task::{QualityOfService, Task, TaskContent, TaskDispatcher};
use serde::{Deserialize, Serialize};
use tokio::sync::RwLock as TokioRwLock;
-use tracing::instrument;
+use tracing::{error, instrument, trace};
use crate::entities::{
CalculationChangesetNotificationPB, CalculationPB, CalculationType, FieldType,
@@ -101,6 +101,10 @@ impl CalculationsController {
)]
pub async fn process(&self, predicate: &str) -> FlowyResult<()> {
let event_type = CalculationEvent::from_str(predicate).unwrap();
+ trace!(
+ "[Database Calculate] Processing calculation event: {:?}",
+ event_type
+ );
match event_type {
CalculationEvent::RowChanged(row) => self.handle_row_changed(&row).await,
CalculationEvent::CellUpdated(field_id) => self.handle_cell_changed(field_id).await,
@@ -224,11 +228,14 @@ impl CalculationsController {
vec![CalculationPB::from(&update)],
);
- let _ = self
+ if let Err(err) = self
.notifier
.send(DatabaseViewChanged::CalculationValueNotification(
notification,
- ));
+ ))
+ {
+ error!("Failed to send calculation notification: {:?}", err);
+ }
}
}
}
@@ -286,11 +293,14 @@ impl CalculationsController {
if !updates.is_empty() {
let notification = CalculationChangesetNotificationPB::from_update(&self.view_id, updates);
- let _ = self
+ if let Err(err) = self
.notifier
.send(DatabaseViewChanged::CalculationValueNotification(
notification,
- ));
+ ))
+ {
+ error!("Failed to send calculation notification: {:?}", err);
+ }
}
}
diff --git a/frontend/rust-lib/flowy-database2/src/services/calculations/service.rs b/frontend/rust-lib/flowy-database2/src/services/calculations/service.rs
index 95ce0f49a3..43feeb6f19 100644
--- a/frontend/rust-lib/flowy-database2/src/services/calculations/service.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/calculations/service.rs
@@ -40,7 +40,7 @@ impl CalculationsService {
);
if len > 0 {
- format!("{:.5}", sum / len as f64)
+ format!("{:.2}", sum / len as f64)
} else {
String::new()
}
@@ -54,7 +54,7 @@ impl CalculationsService {
values.par_sort_by(|a, b| a.partial_cmp(b).unwrap());
if !values.is_empty() {
- format!("{:.5}", Self::median(&values))
+ format!("{:.2}", Self::median(&values))
} else {
String::new()
}
@@ -63,7 +63,7 @@ impl CalculationsService {
fn calculate_min(&self, field: &Field, cells: Vec<Arc<Cell>>) -> String {
let values = self.reduce_values_f64(field, cells);
if let Some(min) = values.par_iter().min_by(|a, b| a.total_cmp(b)) {
- format!("{:.5}", min)
+ format!("{:.2}", min)
} else {
String::new()
}
@@ -72,7 +72,7 @@ impl CalculationsService {
fn calculate_max(&self, field: &Field, cells: Vec<Arc<Cell>>) -> String {
let values = self.reduce_values_f64(field, cells);
if let Some(max) = values.par_iter().max_by(|a, b| a.total_cmp(b)) {
- format!("{:.5}", max)
+ format!("{:.2}", max)
} else {
String::new()
}
@@ -81,7 +81,7 @@ impl CalculationsService {
fn calculate_sum(&self, field: &Field, cells: Vec<Arc<Cell>>) -> String {
let values = self.reduce_values_f64(field, cells);
if !values.is_empty() {
- format!("{:.5}", values.par_iter().sum::<f64>())
+ format!("{:.2}", values.par_iter().sum::<f64>())
} else {
String::new()
}
diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
index 42ef2d8cc0..e284466054 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
@@ -1064,6 +1064,11 @@ impl DatabaseEditor {
view
.v_did_update_row(&old_row, &row, Some(field_id.to_owned()))
.await;
+
+ let field_id = field_id.to_string();
+ tokio::spawn(async move {
+ view.v_update_calculate(&field_id).await;
+ });
}
if let Some(field_type) = field_type {
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs
index 949b42e69a..a3a5e6f484 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs
@@ -11,7 +11,7 @@ use async_stream::stream;
use futures::stream::StreamExt;
use tokio::sync::broadcast;
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub enum DatabaseViewChanged {
FilterNotification(FilterResultNotification),
ReorderAllRowsNotification(ReorderAllRowsResult),
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
index f946a6c881..8b9b7032c7 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
@@ -693,6 +693,41 @@ impl DatabaseViewEditor {
Ok(())
}
+ pub async fn v_update_calculate(&self, field_id: &str) -> Option<()> {
+ let field = self.delegate.get_field(field_id).await?;
+ let cal = self
+ .delegate
+ .get_calculation(&self.view_id, &field.id)
+ .await?;
+
+ let cells = self
+ .delegate
+ .get_cells_for_field(&self.view_id, field_id)
+ .await
+ .into_iter()
+ .flat_map(|row_cell| row_cell.cell.map(Arc::new))
+ .collect::<Vec<_>>();
+
+ let changes = self
+ .calculations_controller
+ .handle_cells_changed(&field, &cal, cells)
+ .await;
+
+ if !changes.is_empty() {
+ let notification = CalculationChangesetNotificationPB::from_update(&self.view_id, changes);
+ if let Err(_err) = self
+ .notifier
+ .send(DatabaseViewChanged::CalculationValueNotification(
+ notification,
+ ))
+ {
+ error!("Failed to send CalculationValueNotification");
+ }
+ }
+
+ None
+ }
+
pub async fn v_calculate_rows(&self, fields: Vec<Field>, rows: Vec<Arc<Row>>) -> FlowyResult<()> {
let mut updates = vec![];
// Filter fields to only those with calculations
diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs
index e4ebcd0e0b..1b0cfa85ae 100644
--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs
@@ -126,7 +126,12 @@ impl CellDataChangeset for NumberTypeOption {
let number_cell_data = NumberCellData(num_str);
let formatter = self.format_cell_data(&number_cell_data)?;
- tracing::trace!("number: {:?}", number_cell_data);
+ tracing::trace!(
+ "NumberTypeOption: {:?}, {}, {}",
+ number_cell_data,
+ formatter.to_string(),
+ formatter.to_unformatted_string()
+ );
match self.format {
NumberFormat::Num => Ok((
NumberCellData(formatter.to_string()).into(),
diff --git a/frontend/rust-lib/flowy-database2/src/services/sort/entities.rs b/frontend/rust-lib/flowy-database2/src/services/sort/entities.rs
index 7ecbca9ef1..9d66ece5cc 100644
--- a/frontend/rust-lib/flowy-database2/src/services/sort/entities.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/sort/entities.rs
@@ -87,7 +87,7 @@ impl From<i64> for SortCondition {
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct ReorderAllRowsResult {
pub view_id: String,
pub row_orders: Vec<String>,
@@ -102,7 +102,7 @@ impl ReorderAllRowsResult {
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct ReorderSingleRowResult {
pub view_id: String,
pub row_id: RowId,
diff --git a/frontend/rust-lib/flowy-database2/tests/database/calculations_test/calculation_test.rs b/frontend/rust-lib/flowy-database2/tests/database/calculations_test/calculation_test.rs
index cfaeb858a5..23e70976e2 100644
--- a/frontend/rust-lib/flowy-database2/tests/database/calculations_test/calculation_test.rs
+++ b/frontend/rust-lib/flowy-database2/tests/database/calculations_test/calculation_test.rs
@@ -9,11 +9,11 @@ use lib_infra::box_any::BoxAny;
async fn calculations_test() {
let mut test = DatabaseCalculationTest::new().await;
- let expected_sum = 25.00000;
- let expected_min = 1.00000;
- let expected_average = 5.00000;
- let expected_max = 14.00000;
- let expected_median = 3.00000;
+ let expected_sum = 25.00;
+ let expected_min = 1.00;
+ let expected_average = 5.00;
+ let expected_max = 14.00;
+ let expected_median = 3.00;
let view_id = &test.view_id();
let number_fields = test
diff --git a/frontend/rust-lib/flowy-database2/tests/database/calculations_test/script.rs b/frontend/rust-lib/flowy-database2/tests/database/calculations_test/script.rs
index cc15e25541..d11ca64c4a 100644
--- a/frontend/rust-lib/flowy-database2/tests/database/calculations_test/script.rs
+++ b/frontend/rust-lib/flowy-database2/tests/database/calculations_test/script.rs
@@ -38,7 +38,7 @@ impl DatabaseCalculationTest {
pub async fn assert_calculation_float_value(&mut self, expected: f64) {
let calculations = self.editor.get_all_calculations(&self.view_id()).await;
let calculation = calculations.items.first().unwrap();
- assert_eq!(calculation.value, format!("{:.5}", expected));
+ assert_eq!(calculation.value, format!("{:.2}", expected));
}
pub async fn assert_calculation_value(&mut self, expected: &str) {
diff --git a/frontend/rust-lib/flowy-document/src/manager.rs b/frontend/rust-lib/flowy-document/src/manager.rs
index 517cb47fea..b84469872b 100644
--- a/frontend/rust-lib/flowy-document/src/manager.rs
+++ b/frontend/rust-lib/flowy-document/src/manager.rs
@@ -281,7 +281,7 @@ impl DocumentManager {
pub async fn get_document_text(&self, doc_id: &str) -> FlowyResult<String> {
let document = self.get_document(doc_id).await?;
let document = document.read().await;
- let text = document.to_plain_text()?;
+ let text = document.to_plain_text(true, false)?;
Ok(text)
}
@@ -360,7 +360,7 @@ impl DocumentManager {
let uid = self.user_service.user_id()?;
let device_id = self.user_service.device_id()?;
if let Ok(doc) = self.editable_document(doc_id).await {
- let mut doc = doc.write().await;
+ let doc = doc.write().await;
let user = DocumentAwarenessUser { uid, device_id };
let selection = state.selection.map(|s| s.into());
let state = DocumentAwarenessState {