Skip to content

Commit 8ee1af9

Browse files
authored
[Refactor:Plagiarism] Resolve TODO in compare hashes (#46)
* Resolve TODO * oops, one more line to remove
1 parent 19df6ab commit 8ee1af9

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

compare_hashes/compare_hashes.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,8 @@ class Submission {
7575
const std::vector<std::pair<hash, location_in_submission>> & getHashes() const { return hashes; }
7676

7777
void addSuspiciousMatch(location_in_submission location, const HashLocation &matching_location, hash matched_hash) {
78-
std::map<location_in_submission, std::set<HashLocation>>::iterator itr = suspicious_matches.find(location);
79-
// TODO: is this if-else necessary? would this not work if we just did?: suspicious_matches[location].insert(matching_location);
80-
if (itr != suspicious_matches.end()) {
81-
// location already exists in the map, so we just append the location to the set
82-
suspicious_matches[location].insert(matching_location);
83-
} else {
84-
// intialize the set and add the location
85-
std::set<HashLocation> s;
86-
s.insert(matching_location);
87-
suspicious_matches[location] = s;
88-
}
78+
// save the found match
79+
suspicious_matches[location].insert(matching_location);
8980
// update the students_matched container
9081
students_matched[matching_location.source_gradeable][matching_location.student][matching_location.version].insert(matched_hash);
9182
}

0 commit comments

Comments
 (0)