show class menu to all titled players - for #6524
parent
3ab230e1f2
commit
13e1927bde
|
@ -12,7 +12,7 @@ object topnav {
|
|||
if (ctx.blind) h3(name) else a(href := url)(name)
|
||||
|
||||
private def canSeeClasMenu(implicit ctx: Context) =
|
||||
ctx.hasClas || ctx.me.exists(_.roles contains "ROLE_COACH")
|
||||
ctx.hasClas || ctx.me.exists(u => u.hasTitle || u.roles.contains("ROLE_COACH"))
|
||||
|
||||
def apply()(implicit ctx: Context) = st.nav(id := "topnav", cls := "hover")(
|
||||
st.section(
|
||||
|
|
|
@ -30,8 +30,6 @@ final class TeamApi(
|
|||
|
||||
import BSONHandlers._
|
||||
|
||||
val creationPeriod = Period weeks 1
|
||||
|
||||
def team(id: Team.ID) = teamRepo.coll.byId[Team](id)
|
||||
|
||||
def light(id: Team.ID) = teamRepo.coll.byId[LightTeam](id, $doc("name" -> true))
|
||||
|
@ -81,8 +79,8 @@ final class TeamApi(
|
|||
|
||||
def hasTeams(me: User): Fu[Boolean] = cached.teamIds(me.id).map(_.value.nonEmpty)
|
||||
|
||||
def hasCreatedRecently(me: User): Fu[Boolean] =
|
||||
teamRepo.userHasCreatedSince(me.id, creationPeriod)
|
||||
def countCreatedRecently(me: User): Fu[Int] =
|
||||
teamRepo.countCreatedSince(me.id, Period weeks 1)
|
||||
|
||||
def requestsWithUsers(team: Team): Fu[List[RequestWithUser]] =
|
||||
for {
|
||||
|
|
|
@ -53,8 +53,8 @@ final class TeamRepo(val coll: Coll)(implicit ec: scala.concurrent.ExecutionCont
|
|||
def name(id: String): Fu[Option[String]] =
|
||||
coll.primitiveOne[String]($id(id), "name")
|
||||
|
||||
def userHasCreatedSince(userId: String, duration: Period): Fu[Boolean] =
|
||||
coll.exists(
|
||||
private[team] def countCreatedSince(userId: String, duration: Period): Fu[Int] =
|
||||
coll.countSel(
|
||||
$doc(
|
||||
"createdAt" $gt DateTime.now.minus(duration),
|
||||
"createdBy" -> userId
|
||||
|
|
Loading…
Reference in New Issue