Skip to content

Commit

Permalink
TRELLO-2846 telephones signalés : remove grouping by category
Browse files Browse the repository at this point in the history
  • Loading branch information
eletallbetagouv committed Jan 16, 2025
1 parent aa97e9b commit 0a3c479
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app/controllers/ReportedPhoneController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ class ReportedPhoneController(
Ok(
Json.toJson(
reports
.mapEntities { case ((phone, siretOpt, companyNameOpt, category), count) =>
.mapEntities { case ((phone, siretOpt, companyNameOpt), count) =>
Json.obj(
"phone" -> phone,
"siret" -> siretOpt,
"companyName" -> companyNameOpt,
"category" -> category,
"count" -> count
)
}
Expand Down
4 changes: 2 additions & 2 deletions app/repositories/report/ReportRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ class ReportRepository(override val dbConfig: DatabaseConfig[JdbcProfile])(impli
end: Option[LocalDate],
offset: Option[Long],
limit: Option[Int]
): Future[PaginatedResult[((Option[String], Option[SIRET], Option[String], String), Int)]] =
): Future[PaginatedResult[((Option[String], Option[SIRET], Option[String]), Int)]] =
table
.filter(_.phone.isDefined)
.filterOpt(q) { case (table, p) =>
Expand All @@ -526,7 +526,7 @@ class ReportRepository(override val dbConfig: DatabaseConfig[JdbcProfile])(impli
.filterOpt(end) { case (table, end) =>
table.creationDate < ZonedDateTime.of(end, LocalTime.MAX, ZoneOffset.UTC.normalized()).toOffsetDateTime
}
.groupBy(a => (a.phone, a.companySiret, a.companyName, a.category))
.groupBy(a => (a.phone, a.companySiret, a.companyName))
.map { case (a, b) => (a, b.length) }
.sortBy(_._2.desc)
.withPagination(db)(
Expand Down
2 changes: 1 addition & 1 deletion app/repositories/report/ReportRepositoryInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ trait ReportRepositoryInterface extends CRUDRepositoryInterface[Report] {
end: Option[LocalDate],
offset: Option[Long],
limit: Option[Int]
): Future[PaginatedResult[((Option[String], Option[SIRET], Option[String], String), Int)]]
): Future[PaginatedResult[((Option[String], Option[SIRET], Option[String]), Int)]]

def reportsCountBySubcategories(
user: User,
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/report/ReportRepositoryMock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ReportRepositoryMock(database: mutable.Map[UUID, Report] = mutable.Map.emp
end: Option[LocalDate],
offset: Option[Long],
limit: Option[Int]
): Future[PaginatedResult[((Option[String], Option[SIRET], Option[String], String), Int)]] = ???
): Future[PaginatedResult[((Option[String], Option[SIRET], Option[String]), Int)]] = ???

override def cloudWord(companyId: UUID): Future[List[ReportWordOccurrence]] = ???

Expand Down

0 comments on commit 0a3c479

Please sign in to comment.