Skip to content

Commit

Permalink
find by uuid and display name in db while adding reviewer and fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tapishr committed Oct 26, 2023
1 parent a5d403c commit e684411
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions vibi-dpu/src/core/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,28 @@ pub async fn process_coverage(hunkmap: &HunkMap, review: &Review, repo_config: &
continue;
}
let blame_author = blame_author_opt.expect("Empty blame_author_opt");
let user_key = blame_author.uuid().to_string();
let user_key = blame_author.display_name().to_string();
let blame_user_opt = get_workspace_user_from_db(&user_key);
if blame_user_opt.is_none() {
eprintln!("[process_coverage] no user found in db for blame author: {:?}", blame_author);
continue;
}
let blame_user = blame_user_opt.expect("Empty blame user");
let blame_users: Vec<BitbucketUser> = blame_user.users().iter().cloned().collect();
let actual_blame_user = blame_users[0].to_owned();
let author_uuid = actual_blame_user.uuid();
let bb_blame_user_opt = blame_user.users().iter().find(|user| user.uuid() == blame_author.uuid());
let bb_blame_user: BitbucketUser;
if bb_blame_user_opt.is_none() {
let bb_users: Vec<BitbucketUser> = blame_user.users().iter().cloned().collect();
let user_opt = bb_users.get(0);
if user_opt.is_none() {
eprintln!("[process_coverage] Empty Bitbucket Workspace User: {:?}", &blame_user);
continue;
}
bb_blame_user = user_opt.expect("Empty user_opt").to_owned();
}
else {
bb_blame_user = bb_blame_user_opt.expect("Empty bb_blame_user_opt").to_owned();
}
let author_uuid = bb_blame_user.uuid();
if author_set.contains(author_uuid) {
continue;
}
Expand Down

0 comments on commit e684411

Please sign in to comment.