/** Anonymify entries. Used before a user gets deleted. */ public void anonymify() { User anonym = User.find("byName", "Anonym").first(); for (MajorEntry entry : entrys) { entry.owner = anonym; entry.save(); } this.refresh(); }
/** * Calculates the reputation earned with entries. * * @return the int */ public int entryReputation() { int reputation = 0; Iterator<MajorEntry> it = this.entrys.iterator(); while (it.hasNext()) { MajorEntry entry = it.next(); reputation += entry.rating(); if (entry instanceof models.Answer && ((Answer) entry).isBestAnswer()) reputation += bestAnswerReputation; } return reputation; }