Permalink
Browse files

Get rid of a var

  • Loading branch information...
Dinduks committed Sep 14, 2012
1 parent b31e1dc commit ad802507303e5b4bd4422f4b9577316a0f2d3e7f
Showing with 3 additions and 2 deletions.
  1. +1 −1 app/models/Contributor.scala
  2. +2 −1 app/models/Repository.scala
@@ -7,7 +7,7 @@ case class Contributor(
override val name: Option[String] = None,
override val email: Option[String] = None,
override val avatarUrl: Option[String] = None,
- var contributionsCounter: Int = 0
+ val contributionsCounter: Int = 0
) extends User(
username,
name,
@@ -62,7 +62,8 @@ object Repository {
contributorsMap.get(key) match {
case Some(contributor) => {
- contributor.contributionsCounter = contributor.contributionsCounter + 1
+ val newContributor = contributor.copy(contributionsCounter = contributor.contributionsCounter + 1)
+ contributorsMap = contributorsMap - key + (key -> newContributor)
}
case None => {
val contributor = Contributor(

0 comments on commit ad80250

Please sign in to comment.