Skip to content

Commit

Permalink
feat: add timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushtom committed Mar 6, 2024
1 parent e68b5cb commit 03c73fa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ impl CompletedTasksTrait for AppState {
// save the user_exp document in the collection
let user_exp_collection = self.db.collection("user_exp");
// add doc with address ,experience and timestamp
let timestamp: f64 = Utc::now().timestamp_millis() as f64;
let document = doc! { "address": addr.to_string(), "experience":experience, "timestamp":timestamp};
user_exp_collection.insert_one(document, None).await?;
let view_collection: Collection<LeaderboardTable> =
Expand Down Expand Up @@ -320,6 +321,7 @@ impl AchievementsTrait for AppState {

let user_exp_collection = self.db.collection("user_exp");
// add doc with address ,experience and timestamp
let timestamp: f64 = Utc::now().timestamp_millis() as f64;
let document = doc! { "address": addr.to_string(), "experience":experience, "timestamp":timestamp};
user_exp_collection.insert_one(document, None).await?;
let view_collection: Collection<LeaderboardTable> =
Expand Down

0 comments on commit 03c73fa

Please sign in to comment.