Skip to content

Commit

Permalink
Fix many compilation errors
Browse files Browse the repository at this point in the history
Fix some more compilation errors

Fix a few more compilation errors
  • Loading branch information
ioannakok committed Aug 2, 2022
1 parent 94c4972 commit 4ff0f98
Show file tree
Hide file tree
Showing 176 changed files with 749 additions and 646 deletions.
2 changes: 1 addition & 1 deletion admin/app/controllers/admin/TroubleshooterController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import play.api.libs.ws.WSClient
import play.api.mvc.{Action, AnyContent, BaseController, ControllerComponents}
import tools.LoadBalancer

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.Random
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ class AdsDotTextEditController(val controllerComponents: ControllerComponents)(i
postSave: Call,
): Action[AnyContent] =
Action { implicit request =>
AdsTextSellers.form.bindFromRequest.fold(
formWithErrors => {
NoCache(BadRequest(views.html.commercial.adsDotText(name, saveRoute, formWithErrors)))
},
adsTextSellers => {
S3.putPrivate(s3DotTextKey, adsTextSellers.sellers, "text/plain")
log.info(s"Wrote new $name file to $s3DotTextKey")
NoCache(Redirect(postSave))
},
)
AdsTextSellers.form
.bindFromRequest()
.fold(
formWithErrors => {
NoCache(BadRequest(views.html.commercial.adsDotText(name, saveRoute, formWithErrors)))
},
adsTextSellers => {
S3.putPrivate(s3DotTextKey, adsTextSellers.sellers, "text/plain")
log.info(s"Wrote new $name file to $s3DotTextKey")
NoCache(Redirect(postSave))
},
)
}

def postAdsDotText(): Action[AnyContent] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ class TakeoverWithEmptyMPUsController(val controllerComponents: ControllerCompon

def create(): Action[AnyContent] =
Action { implicit request =>
TakeoverWithEmptyMPUs.form.bindFromRequest.fold(
formWithErrors => {
NoCache(BadRequest(views.html.commercial.takeoverWithEmptyMPUsCreate(formWithErrors)))
},
takeover => {
TakeoverWithEmptyMPUs.create(takeover)
NoCache(Redirect(routes.TakeoverWithEmptyMPUsController.viewList()))
},
)
TakeoverWithEmptyMPUs.form
.bindFromRequest()
.fold(
formWithErrors => {
NoCache(BadRequest(views.html.commercial.takeoverWithEmptyMPUsCreate(formWithErrors)))
},
takeover => {
TakeoverWithEmptyMPUs.create(takeover)
NoCache(Redirect(routes.TakeoverWithEmptyMPUsController.viewList()))
},
)
}

def remove(url: String): Action[AnyContent] =
Expand Down
2 changes: 1 addition & 1 deletion admin/app/controllers/cache/ImageDecacheController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ImageDecacheController(

ImageServices.clearFastly(originUri, wsClient)

val decacheRequest: Future[WSResponse] = wsClient.url(s"$originUrl?cachebust=$cacheBust").get
val decacheRequest: Future[WSResponse] = wsClient.url(s"$originUrl?cachebust=$cacheBust").get()
decacheRequest
.map(_.status)
.map {
Expand Down
4 changes: 2 additions & 2 deletions admin/app/dfp/DataAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ trait DataAgent[K, V] extends GuLogging with implicits.Strings {
freshCache
case Success(_) =>
log.error("No fresh data loaded so keeping old data")
cache.get
cache.get()
case Failure(e) =>
log.error("Loading of fresh data has failed.", e)
cache.get
cache.get()
}
}

Expand Down
12 changes: 6 additions & 6 deletions admin/app/dfp/DataMapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import dfp.ApiHelper.{isPageSkin, optJavaInt, toJodaTime, toSeq}
// These mapping functions use libraries that are only available in admin to create common DFP data models.
class DataMapper(
adUnitService: AdUnitService,
placementService: PlacementService,
customTargetingService: CustomTargetingService,
customFieldService: CustomFieldService,
placementService: dfp.PlacementService,
customTargetingService: dfp.CustomTargetingService,
customFieldService: dfp.CustomFieldService,
) {

def toGuAdUnit(dfpAdUnit: AdUnit): GuAdUnit = {
Expand Down Expand Up @@ -46,15 +46,15 @@ class DataMapper(
CustomTarget(
customTargetingService.targetingKey(session)(criterion.getKeyId),
criterion.getOperator.getValue,
criterion.getValueIds map (valueId =>
criterion.getValueIds.toSeq map (valueId =>
customTargetingService.targetingValue(session)(criterion.getKeyId, valueId),
),
)

val targets = criteria.getChildren collect {
case criterion: CustomCriteria => criterion
} map toCustomTarget
CustomTargetSet(criteria.getLogicalOperator.getValue, targets)
CustomTargetSet(criteria.getLogicalOperator.getValue, targets.toIndexedSeq)
}

criteriaSets.getChildren
Expand Down Expand Up @@ -105,7 +105,7 @@ class DataMapper(
GuCreativePlaceholder(AdSize(size.getWidth, size.getHeight), targeting)
}

placeholders sortBy { placeholder =>
placeholders.toIndexedSeq sortBy { placeholder =>
val size = placeholder.size
(size.width, size.height)
}
Expand Down
2 changes: 2 additions & 0 deletions admin/app/dfp/DfpApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class DfpApi(dataMapper: DataMapper, dataValidation: DataValidation) extends GuL
// item, potentially making one API call per lineitem.
val validatedLineItems = lineItems
.groupBy(Function.tupled(dataValidation.isGuLineItemValid))
.view
.mapValues(_.map(_._1))
.toMap

DfpLineItems(
validItems = validatedLineItems.getOrElse(true, Nil),
Expand Down
8 changes: 4 additions & 4 deletions admin/app/dfp/SessionWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import common.GuLogging
import conf.{AdminConfiguration, Configuration}
import dfp.Reader.read
import dfp.SessionLogger.{logAroundCreate, logAroundPerform, logAroundRead, logAroundReadSingle}
import collection.JavaConverters._
import scala.jdk.CollectionConverters._

import scala.util.control.NonFatal

Expand Down Expand Up @@ -140,7 +140,7 @@ private[dfp] class SessionWrapper(dfpSession: AdManagerSession) {
options.setExportFormat(ExportFormat.CSV_DUMP)
options.setUseGzipCompression(true)
val charSource: CharSource = reportDownloader.getReportAsCharSource(options)
charSource.readLines().asScala
charSource.readLines().asScala.toSeq
}

object lineItemCreativeAssociations {
Expand All @@ -164,7 +164,7 @@ private[dfp] class SessionWrapper(dfpSession: AdManagerSession) {

def create(licas: Seq[LineItemCreativeAssociation]): Seq[LineItemCreativeAssociation] = {
logAroundCreate(typeName) {
licaService.createLineItemCreativeAssociations(licas.toArray)
licaService.createLineItemCreativeAssociations(licas.toArray).toIndexedSeq
}
}

Expand Down Expand Up @@ -193,7 +193,7 @@ private[dfp] class SessionWrapper(dfpSession: AdManagerSession) {

def create(creatives: Seq[Creative]): Seq[Creative] = {
logAroundCreate(typeName) {
creativeService.createCreatives(creatives.toArray)
creativeService.createCreatives(creatives.toArray).toIndexedSeq
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions admin/app/football/controllers/PlayerController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class PlayerController(val wsClient: WSClient, val controllerComponents: Control
client.appearances(playerId, competition.startDate, LocalDate.now(), teamId, competitionId)
} yield {
val result = createPlayerCard(cardType, playerId, playerProfile, playerStats, playerAppearances)
result.map(renderPlayerCard).getOrElse(renderNotFound)
result.map(renderPlayerCard).getOrElse(renderNotFound())
}
}
}
Expand All @@ -94,7 +94,7 @@ class PlayerController(val wsClient: WSClient, val controllerComponents: Control
playerAppearances <- client.appearances(playerId, startDate, LocalDate.now(), teamId)
} yield {
val result = createPlayerCard(cardType, playerId, playerProfile, playerStats, playerAppearances)
result.map(renderPlayerCard).getOrElse(renderNotFound)
result.map(renderPlayerCard).getOrElse(renderNotFound())
}
}

Expand Down
2 changes: 1 addition & 1 deletion admin/app/indexes/ContentApiTagsEnumerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ContentApiTagsEnumerator(contentApiClient: ContentApiClient)(implicit exec
def enumerateTagType(tagType: String): Future[Seq[Tag]] = {
val tagQuery = contentApiClient.tags.tagType(tagType).pageSize(MaxPageSize)
contentApiClient.thriftClient.paginateAccum(tagQuery)(
{ r: TagsResponse => r.results.filter(isSuitableTag) },
{ r: TagsResponse => r.results.filter(isSuitableTag).toSeq },
{ (a: Seq[Tag], b: Seq[Tag]) => a ++ b },
)
}
Expand Down
2 changes: 1 addition & 1 deletion admin/app/jobs/AnalyticsSanityCheckJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import model.diagnostics.CloudWatch
import java.time.{LocalDateTime, ZoneId}
import services.{CloudWatchStats, OphanApi}

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{ExecutionContext, Future}

class AnalyticsSanityCheckJob(ophanApi: OphanApi) extends GuLogging {
Expand Down
4 changes: 2 additions & 2 deletions admin/app/jobs/FastlyCloudwatchLoadJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class FastlyCloudwatchLoadJob(fastlyStatisticService: FastlyStatisticService) ex
}

val groups = fresh groupBy { _.key }
val timestampsSent = groups mapValues { _ map { _.timestamp } }
timestampsSent mapValues { _.max } foreach {
val timestampsSent = groups.view mapValues { _ map { _.timestamp } }
timestampsSent.view mapValues { _.max } foreach {
case (key, value) =>
latestTimestampsSent.update(key, value)
}
Expand Down
2 changes: 1 addition & 1 deletion admin/app/model/AdminLifecycle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AdminLifecycle(
}

jobs.scheduleEvery("R2PagePressJob", r2PagePressRateInSeconds.seconds) {
r2PagePressJob.run
r2PagePressJob.run()
}

//every 2, 17, 32, 47 minutes past the hour, on the 12th second past the minute (e.g 13:02:12, 13:17:12)
Expand Down
4 changes: 2 additions & 2 deletions admin/app/model/abtests/AbTestJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import common.GuLogging
import tools.CloudWatch
import views.support.CamelCase

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.ExecutionContext

object AbTestJob extends GuLogging {
Expand All @@ -27,7 +27,7 @@ object AbTestJob extends GuLogging {
val testVariants = switches.foldLeft(Map.empty[String, Seq[String]])((acc, switch) => {
if (tests.isDefinedAt(switch)) {
// Update map with a list of variants for the ab-test switch.
acc.updated(switch, tests(switch).map(_._2))
acc.updated(switch, tests(switch).map(_._2).toSeq)
} else {
acc
}
Expand Down
2 changes: 1 addition & 1 deletion admin/app/services/EmailService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.amazonaws.services.simpleemail.model.{Destination => EmailDestination
import common.{AkkaAsync, GuLogging}
import conf.Configuration.aws.mandatoryCredentials

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.control.NonFatal
Expand Down
4 changes: 2 additions & 2 deletions admin/app/tools/AssetMetrics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import common.{Box, GuLogging}
import org.joda.time.DateTime
import tools.CloudWatch._

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{ExecutionContext, Future}
import scala.math.BigDecimal
import scala.util.control.NonFatal
Expand Down Expand Up @@ -91,7 +91,7 @@ object AssetMetricsCache extends GuLogging {
.sizeMetrics()
.map { metrics =>
log.info("Successfully refreshed Asset Metrics data")
cache.send(cache.get + (ReportTypes.sizeOfFiles -> metrics))
cache.send(cache.get() + (ReportTypes.sizeOfFiles -> metrics))
}
.recover {
case NonFatal(e) =>
Expand Down
2 changes: 1 addition & 1 deletion admin/app/tools/CloudWatch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import conf.Configuration
import conf.Configuration._
import org.joda.time.DateTime

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{ExecutionContext, Future}

case class MaximumMetric(metric: GetMetricStatisticsResult) {
Expand Down
2 changes: 1 addition & 1 deletion admin/app/tools/LoadBalancer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tools
import common.{Box, GuLogging}
import com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

case class LoadBalancer(
id: String,
Expand Down
17 changes: 10 additions & 7 deletions admin/app/tools/charts/charts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import common.editions.Uk
import org.joda.time.{DateTime, DateTimeZone}
import play.api.libs.json._

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.mutable.{Map => MutableMap}

case class ChartRow[K](rowKey: K, values: Seq[Double])
Expand Down Expand Up @@ -47,7 +47,7 @@ class ChartTable(private val labels: Seq[String]) {
ChartRow(dateFormat(new DateTime(row._1)), row._2)
}

chartRows.seq
chartRows
}
}

Expand Down Expand Up @@ -118,9 +118,11 @@ class AwsLineChart(
val dataColumns = labels.tail
val table = new ChartTable(dataColumns)

(dataColumns, charts.toList).zipped.map((column, chart) => {
table.addColumn(column, ChartColumn(chart.getDatapoints.asScala))
})
dataColumns
.lazyZip(charts.toList)
.map((column, chart) => {
table.addColumn(column, ChartColumn(chart.getDatapoints.asScala.toSeq))
})

table.asChartRow(toLabel, toValue)
}
Expand Down Expand Up @@ -158,8 +160,9 @@ class ABDataChart(name: String, ablabels: Seq[String], format: ChartFormat, char
private val dataColumns: Seq[(String, ChartColumn)] = {

// Do not consider any metrics that have less than three data points.
(ablabels.tail, charts.toList).zipped
.map((column, chart) => (column, ChartColumn(chart.getDatapoints.asScala)))
ablabels.tail
.lazyZip(charts.toList)
.map((column, chart) => (column, ChartColumn(chart.getDatapoints.asScala.toSeq)))
.filter { case (label, column) => column.values.length > 3 }
}

Expand Down
2 changes: 1 addition & 1 deletion admin/app/views/commercial/adsDotText.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1>@{name} editor</h1>
}
</ul>
}
@textarea(sellersForm("sellers"), '_label -> "Authorised sellers:", 'rows -> 30, 'cols -> 100, '_help -> "")
@textarea(sellersForm("sellers"), Symbol("_label") -> "Authorised sellers:", Symbol("rows") -> 30, Symbol("cols") -> 100, Symbol("_help") -> "")

<input class="btn btn-large btn-success" type="submit" value="Save" />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ <h1>New Takeover with Empty MPUs</h1>
}
</ul>
}
@inputText(takeoverForm("url"), '_label -> "Paste URL here:", 'size -> 100, '_help -> "")
@inputText(takeoverForm("url"), Symbol("_label")-> "Paste URL here:", Symbol("size") -> 100, Symbol("_help") -> "")
@select(
takeoverForm("editions"),
options = for(e <- Edition.all) yield { e.id -> e.displayName },
'multiple -> true,
'_label -> "Editions this applies to (one or multiple):"
Symbol("multiple") -> true,
Symbol("_label") -> "Editions this applies to (one or multiple):"
)
@input(takeoverForm("startTime"), '_label -> "Takeover starts (UTC):", '_help -> "") { (id, name, value, args) =>
@input(takeoverForm("startTime"), Symbol("_label") -> "Takeover starts (UTC):", Symbol("_help") -> "") { (id, name, value, args) =>
<input type="datetime-local" name="@name" id="@id" @toHtmlArgs(args)>
}
@input(takeoverForm("endTime"), '_label -> "Takeover ends (UTC):", '_help -> "") { (id, name, value, args) =>
@input(takeoverForm("endTime"), Symbol("_label") -> "Takeover ends (UTC):", Symbol("_help") -> "") { (id, name, value, args) =>
<input type="datetime-local" name="@name" id="@id" @toHtmlArgs(args)>
}
<input class="btn btn-large btn-success" type="submit" value="Save" />
Expand Down
2 changes: 1 addition & 1 deletion admin/app/views/fragments/formattedChart.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<script type="text/javascript">
function drawChart() {
var data = new google.visualization.DataTable(@{Html(chart.asJson.toString)})
var data = new google.visualization.DataTable(@{Html(chart.asJson().toString)})

var chart = new google.visualization.LineChart(document.getElementById('@chart.id'));

Expand Down
2 changes: 1 addition & 1 deletion admin/conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ GET /troubleshoot/test
# Football admin
GET /admin/football controllers.admin.SiteController.index
GET /admin/football/browse controllers.admin.PaBrowserController.browse
POST /admin/football/browserRedirect controllers.admin.PaBrowserController.browserSubstitution
POST /admin/football/browserRedirect controllers.admin.PaBrowserController.browserSubstitution()
GET /admin/football/browser/*query controllers.admin.PaBrowserController.browser(query)
GET /admin/football/player controllers.admin.PlayerController.playerIndex
POST /admin/football/player/card controllers.admin.PlayerController.redirectToCard
Expand Down
Loading

0 comments on commit 4ff0f98

Please sign in to comment.