Skip to content

Commit

Permalink
Merge pull request #280 from asobolev/master
Browse files Browse the repository at this point in the history
bugfix with unique short for confs
  • Loading branch information
stoewer committed Mar 23, 2015
2 parents 7f3b33d + 67722bb commit eb478cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ class Application(implicit val env: Environment[Login, CachedCookieAuthenticator
}

def conferences = UserAwareAction { implicit request =>
val is_admin = request.identity match {
case Some(uid) => uid.account.isAdmin
case _ => false
}

val conferences = conferenceService.list()

val list_opened = conferences.filter(conf => conf.isOpen)
val list_published = conferences.filter(conf => conf.isPublished && !conf.isOpen)
var list_opened = conferences.filter(conf => !list_published.contains(conf))
if (!is_admin) {
list_opened = list_opened.filter(conf => conf.isOpen)
}

Ok(views.html.conferencelist(request.identity.map{ _.account }, list_opened, list_published))
}
Expand Down Expand Up @@ -112,7 +120,6 @@ class Application(implicit val env: Environment[Login, CachedCookieAuthenticator
}
}


def adminAbstracts(confId: String) = SecuredAction { implicit request =>
val conference = conferenceService.get(confId)

Expand Down
1 change: 1 addition & 0 deletions app/models/Conference.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Conference extends Model with Owned {
def dateFormatter = DateTimeFormat.forPattern("d MMMM, yyyy")

var name: String = _
@Column(unique = true)
var short: String = _
var cite: String = _
var link: String = _
Expand Down
2 changes: 1 addition & 1 deletion test/controller/ConferenceCtrlTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ConferenceCtrlTest extends BaseCtrlTest {

@Test
def testCreate(): Unit = {
val body = formatter.writes(assets.conferences(0)).as[JsObject] - "uuid" - "abstracts"
val body = formatter.writes(assets.conferences(0)).as[JsObject] - "uuid" - "abstracts" - "short"

val createUnauth = FakeRequest(POST, "/api/conferences").withHeaders(
("Content-Type", "application/json")
Expand Down

0 comments on commit eb478cf

Please sign in to comment.