Skip to content

Commit

Permalink
all talks on Parleys
Browse files Browse the repository at this point in the history
  • Loading branch information
nicmarti committed Apr 28, 2014
1 parent 62d6722 commit b36ec23
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 5 deletions.
26 changes: 26 additions & 0 deletions app/controllers/CFPAdmin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,32 @@ object CFPAdmin extends SecureCFPController {
Proposal.resetPreferredDay(proposalId: String)
Redirect(routes.CFPAdmin.openForReview(proposalId)).flashing("success" -> "No preferences")
}

def allTalksForParleys()=SecuredAction(IsMemberOf("cfp")){
implicit request: SecuredRequest[play.api.mvc.AnyContent] =>

val onParleys = List(ProposalType.UNI.id, ProposalType.CONF.id, ProposalType.TIA.id, ProposalType.KEY.id, ProposalType.QUICK.id)

val publishedIDs = onParleys.flatMap{ confType=>
ScheduleConfiguration.getPublishedSchedule(confType)
}

val filteredList = publishedIDs.flatMap{
id:String=>
ScheduleConfiguration.loadScheduledConfiguration(id)
}

val notRecorded=Room.allRoomsNotRecorded.map(_.id)

val slots = filteredList.map(_.slots)
.flatten
.filterNot(s=>notRecorded.contains(s.room.id))
.filter(_.proposal.isDefined)
.sortBy(_.from.toDate.getTime)

Ok(views.html.CFPAdmin.allTalksOnParley(slots))

}
}


4 changes: 1 addition & 3 deletions app/controllers/SchedullingController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object SchedullingController extends SecureCFPController {
implicit request: SecuredRequest[play.api.mvc.AnyContent] =>
import ScheduleConfiguration.scheduleSavedFormat

val scheduledSlotsKey = ScheduleConfiguration.allScheduledConfiguration()
val scheduledSlotsKey = ScheduleConfiguration.allScheduledConfigurationWithLastModified()
val json = Json.toJson(Map("scheduledConfigurations" -> Json.toJson(
scheduledSlotsKey.map {
case (key, dateAsDouble) =>
Expand Down Expand Up @@ -194,8 +194,6 @@ object SchedullingController extends SecureCFPController {
}.getOrElse {
BadRequest("{\"status\":\"expecting json data\"}").as("application/json")
}


}

def getPublishedSchedule(confType:String, day:Option[String])=Action{
Expand Down
4 changes: 2 additions & 2 deletions app/models/ScheduleConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ package models

import library.Redis
import play.api.libs.json.Json
import org.joda.time.DateTime
import org.apache.commons.lang3.RandomStringUtils
import scala.util.Random
import org.joda.time.DateTime

/**
* Slots that are scheduled.
Expand Down Expand Up @@ -91,7 +91,7 @@ object ScheduleConfiguration {
tx.exec()
}

def allScheduledConfiguration(): List[(String, Double)] = Redis.pool.withClient {
def allScheduledConfigurationWithLastModified(): List[(String, Double)] = Redis.pool.withClient {
implicit client =>
client.zrevrangeWithScores("ScheduleConfiguration", 0, -1)
}
Expand Down
34 changes: 34 additions & 0 deletions app/models/Slot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ object Room {
Room.MILES_DAVIS_A_TH, Room.MILES_DAVIS_B_TH, Room.MILES_DAVIS_C_TH,
Room.SEINE_A, Room.SEINE_B, Room.SEINE_C, Room.AUDITORIUM)

val allRoomsNotRecorded = List(Room.ELLA_FITZGERALD_AB_TH, Room.LOUIS_ARMSTRONG_AB_TH, Room.LOUIS_ARMSTRONG_CD_TH,
Room.MILES_DAVIS_A_TH, Room.MILES_DAVIS_B_TH, Room.MILES_DAVIS_C_TH)


val allRooms = allBigRoom ++ List(Room.ELLA_FITZGERALD, Room.MILES_DAVIS)

// No E.Fitzgerald for Apres-midi des decideurs
Expand Down Expand Up @@ -139,6 +143,32 @@ object Room {
case other => OTHER
}
}

// Small helper function that is specific to devoxxfr2014
def idBVRent(room:Room):String={
room.id match {
case "seine_keynote" => "K"
case "seine_a" => "A"
case "seine_b" => "B"
case "seine_c" => "C"
case "auditorium" => "AU"
case "el_ab" => "EL"
case "el_ab_th" => "EL"
case "el_ab_full" => "EL"
case "la_ab" => "LA"
case "la_ab_th" => "LA"
case "la_cd" => "LA"
case "la_cd_th" => "LA"
case "md_a" => "MD"
case "md_a_th" => "MD"
case "md_b" => "MD"
case "md_b_th" => "MD"
case "md_c" => "MD"
case "md_c_th" => "MD"
case "md_full" => "MD"
case other => "??"+other
}
}
}

case class SlotBreak(id: String, nameEN: String, nameFR: String, room: Room)
Expand All @@ -162,6 +192,10 @@ case class Slot(id: String, name: String, day: String, from: DateTime, to: DateT
break.isEmpty && proposal.isEmpty
}

def idForBVRent:String={
from.getDayOfMonth+"-"+ name.head.toUpper+"-" + Room.idBVRent(room)
}

}

object SlotBuilder {
Expand Down
38 changes: 38 additions & 0 deletions app/views/CFPAdmin/allTalksOnParley.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@(slots: List[Slot])(implicit lang: Lang, flash: Flash, req: RequestHeader)

@main("All talks on Parleys") {
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h1><i class="icon-camera"></i> Recorded talks</h1>
@slots.size talks (some TIA haven't been recorded and are already excluded from this list)
</div>
</div>
</div>

<table class="table table-bordered table-stripped">
<thead>
<th>ID DevoxxFR</th>
<th>ID BV Rent <br>(experimental)</th>
<th>Room</th>
<th>Contact speakers</th>
<th>Talk title</th>
<th>Speakers</th>
</thead>
<tbody>
@slots.map{slot =>
<tr>
<td>@slot.id</td>
<td>@slot.idForBVRent</td>
<td>@slot.room.name</td>
<td>@slot.proposal.map{p=>
@tags.linkToProposal(p.id)
}</td>
<td>@slot.proposal.map(_.title)</td>
<td>@slot.proposal.map(_.allSpeakers.map(_.cleanName).mkString(", "))</td>
</tr>
}
</tbody>
</table>
}
2 changes: 2 additions & 0 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ GET /badges controllers
POST /badges controllers.Badge.uploadCSV()
GET /badges/test controllers.Badge.test()

# Parleys talks
GET /devoxxfr2014/talksOnParleys controllers.CFPAdmin.allTalksForParleys()

# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)

0 comments on commit b36ec23

Please sign in to comment.