Closed gessfred closed 6 years ago
Optional's are only available from Java8 is what i meant and creating our own version would be too much work to just not use null
I suggest that code if multiple exits in findNextAdmin() disturbs you :) tell me what you think about it :
public Group findNextAdmin(Group g, Iterator<Pair> it) {
Group group = null;
if(g != null && it != null) {
while (it.hasNext() && group == null) {
Pair p = it.next();
if (p.getValue().equals(g.getGroupID().getId())) {
group = g.withAdmin(p.getKey());
}
}
}
return group;
}
Ok yeah great proposition, works for me
@geofot96 is it possible to put a threshold for the total coverage in the repository instead of a positive % of change condition, in addition test coverage on the diff in this pull request? Just a suggestion
Code Climate has analyzed commit 30febd94 and detected 0 issues on this pull request.
The test coverage on the diff in this pull request is 92.8% (80% is the threshold).
This pull request will bring the total coverage in the repository to 83.3% (0.0% change).
View more on Code Climate.
10
AdminID is now stored in Group (directly no table) Groups of which the authentified user is admin are annotated as such (crown emoji) The actual privileges need to be checked later(meeting setting, group setting) as well as the rotation when the admin leaves the group
30
Two new MetaGroup core functions findAdmin and rotateAdmin with one front-end function removeUserFromGroup.
findAdmin should return an optionnal but to cope with API version restrictions it returns a null when the group has no potential admin left. All this to not have the function mutate state. Maybe Group should be immutable by the way.
rotateAdmin retrieves the userGroup table(does not call getGroupUsers because it needs another Consumer) and uses the return value of findAdmin to either: