Skip to content

Commit

Permalink
Assign unique IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Sep 27, 2024
1 parent 1e1ba0e commit fdc882e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object SampleUsers {
)

private val sampleUser3 = UserWithEditContext(
id = 1,
id = 3,
username = "@sampleUser",
avatarUrls = emptyMap(),
capabilities = emptyMap(),
Expand All @@ -72,11 +72,16 @@ object SampleUsers {

@Suppress("MagicNumber")
fun getSampleUsers(): ArrayList<UserWithEditContext> {
fun addWithId(user: UserWithEditContext) {
sampleUserList.add(
user.copy(id = sampleUserList.size)
)
}
if (sampleUserList.isEmpty()) {
repeat(25) {
sampleUserList.add(sampleUser1)
sampleUserList.add(sampleUser2)
sampleUserList.add(sampleUser3)
addWithId(sampleUser1)
addWithId(sampleUser2)
addWithId(sampleUser3)
}
}
return sampleUserList
Expand Down

0 comments on commit fdc882e

Please sign in to comment.