various search improvements
This commit is contained in:
parent
ea6f281cfa
commit
309157305f
|
@ -361,7 +361,7 @@ case class DbGame(
|
|||
|
||||
def averageUsersElo = userElos match {
|
||||
case a :: b :: Nil ⇒ Some((a + b) / 2)
|
||||
case a :: Nil ⇒ Some(a)
|
||||
case a :: Nil ⇒ Some(a + 1200) / 2
|
||||
case Nil ⇒ None
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ case class SearchData(
|
|||
dateMax: Option[String],
|
||||
status: Option[Int],
|
||||
sortField: String = Sorting.default.field,
|
||||
sortOrder: String = Sorting.default.field) {
|
||||
sortOrder: String = Sorting.default.order) {
|
||||
|
||||
lazy val query = Query(
|
||||
usernames = (~usernames).split(" ").toList map clean filter (_.nonEmpty),
|
||||
|
|
|
@ -52,7 +52,7 @@ case class Query(
|
|||
date map Game.dateFormatter.print filters fields.date,
|
||||
averageElo filters fields.date,
|
||||
hasAiFilters,
|
||||
aiLevel filters fields.ai,
|
||||
(hasAi | true).fold(aiLevel filters fields.ai, Nil),
|
||||
toFilters(variant, fields.variant),
|
||||
toFilters(rated, fields.rated),
|
||||
toFilters(opening, fields.opening),
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.traackr.scalastic.elasticsearch.SearchParameterTypes.FieldSort
|
|||
case class Sorting(field: String, order: String) {
|
||||
|
||||
def fieldSort = FieldSort(
|
||||
field = (Sorting.fields contains field).fold(field, Sorting.default.field),
|
||||
field = (Sorting.fieldKeys contains field).fold(field, Sorting.default.field),
|
||||
order = (order.toLowerCase == "asc").fold(SortOrder.ASC, SortOrder.DESC)
|
||||
)
|
||||
}
|
||||
|
@ -19,6 +19,8 @@ object Sorting {
|
|||
Game.fields.turns -> "Turns",
|
||||
Game.fields.averageElo -> "Average ELO")
|
||||
|
||||
def fieldKeys = fields map (_._1)
|
||||
|
||||
val orders = List(SortOrder.ASC, SortOrder.DESC) map { s ⇒ s.toString -> s.toString }
|
||||
|
||||
val default = Sorting(Game.fields.date, "desc")
|
||||
|
|
|
@ -7,7 +7,7 @@ import play.api.templates.Html
|
|||
|
||||
trait AssetHelper {
|
||||
|
||||
val assetVersion = 70
|
||||
val assetVersion = 71
|
||||
|
||||
def cssTag(name: String) = css("stylesheets/" + name)
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ moreCss = moreCss) {
|
|||
<th>
|
||||
<label for="@form("hasAi").id">Opponent</label>
|
||||
</th>
|
||||
<td class="single">
|
||||
<td class="single opponent">
|
||||
@select(form("hasAi"), Query.hasAis, "Human or Computer".some)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="aiLevel">
|
||||
<th>
|
||||
<label for="@form("aiLevel").id">Stockfish level</label>
|
||||
</th>
|
||||
|
|
|
@ -17,4 +17,9 @@ $(function() {
|
|||
$('body').trigger('lichess.content_loaded');
|
||||
});
|
||||
});
|
||||
|
||||
var $form = $("form.search");
|
||||
$form.find(".opponent select").change(function() {
|
||||
$form.find(".aiLevel").toggle($(this).val() == 1);
|
||||
}).trigger("change");
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ body.dark {
|
|||
color: #909090;
|
||||
}
|
||||
|
||||
body.dark a,
|
||||
body.dark a,
|
||||
body.dark a:visited {
|
||||
color: #909090;
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ body.dark form.translation_form input,
|
|||
body.dark div.locale_menu a,
|
||||
body.dark div.adv_chart,
|
||||
body.dark #top .dropdown,
|
||||
body.dark div.lichess_overboard p.explanations
|
||||
body.dark div.lichess_overboard p.explanations,
|
||||
body.dark form.search
|
||||
{
|
||||
border-color: #3e3e3e;
|
||||
}
|
||||
|
@ -99,7 +100,7 @@ body.dark #top ul.language_links a:hover
|
|||
color: #b0b0b0;
|
||||
}
|
||||
|
||||
body.dark #site_title,
|
||||
body.dark #site_title,
|
||||
body.dark #site_baseline,
|
||||
body.dark div.anon_chat a.user_link,
|
||||
body.dark div.undertable a.user_link,
|
||||
|
@ -112,9 +113,9 @@ body.dark #site_title span.extension {
|
|||
color: #707070;
|
||||
}
|
||||
|
||||
body.dark #top a.goto_nav:hover,
|
||||
body.dark #top a.toggle:hover,
|
||||
body.dark #top a.bgpicker:hover,
|
||||
body.dark #top a.goto_nav:hover,
|
||||
body.dark #top a.toggle:hover,
|
||||
body.dark #top a.bgpicker:hover,
|
||||
body.dark a#sound_state:hover,
|
||||
body.dark #top .dropdown,
|
||||
body.dark #top .shown a.toggle {
|
||||
|
@ -164,15 +165,12 @@ body.dark div.lichess_overboard {
|
|||
body.dark div.lichess_overboard.game_config {
|
||||
box-shadow: 0 0 20px #d0d0d0;
|
||||
}
|
||||
body.dark div.game_config .optional_config {
|
||||
background: #343434;
|
||||
}
|
||||
|
||||
body.dark div.lichess_table_not_started {
|
||||
box-shadow: none;
|
||||
background: none;
|
||||
}
|
||||
body.dark div.lichess_table a.lichess_button:hover,
|
||||
body.dark div.lichess_table a.lichess_button:hover,
|
||||
body.dark div.lichess_table a.lichess_button.active {
|
||||
box-shadow: 0 0 9px #d85000;
|
||||
border: 1px solid #d85000;
|
||||
|
@ -204,7 +202,9 @@ body.dark div.content_box_inter,
|
|||
body.dark #GameText tr:nth-child(even),
|
||||
body.dark table.translations tbody tr:nth-child(even),
|
||||
body.dark form.translation_form div.message:nth-child(even),
|
||||
body.dark div.content_box table.datatable tr:nth-child(odd)
|
||||
body.dark div.content_box table.datatable tr:nth-child(odd),
|
||||
body.dark div.game_config .optional_config,
|
||||
body.dark form.search
|
||||
{
|
||||
background: #343434;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ body.dark #lichess_forum div.post .message,
|
|||
body.dark #GameText a.move,
|
||||
body.dark form.translation_form div.message label,
|
||||
body.dark div.content_box h1,
|
||||
body.dark div.hooks a
|
||||
body.dark div.hooks a
|
||||
{
|
||||
color: #b0b0b0;
|
||||
}
|
||||
|
@ -263,14 +263,14 @@ body.dark div.checkmateFen div.lmcs:hover {
|
|||
}
|
||||
|
||||
/* soft inactive gradient */
|
||||
body.dark #top,
|
||||
body.dark div.lichess_chat_top,
|
||||
body.dark div.undertable_top,
|
||||
body.dark .button,
|
||||
body.dark .button:visited,
|
||||
body.dark .ui-state-default,
|
||||
body.dark div.content_box_top,
|
||||
body.dark div.hooks tr,
|
||||
body.dark #top,
|
||||
body.dark div.lichess_chat_top,
|
||||
body.dark div.undertable_top,
|
||||
body.dark .button,
|
||||
body.dark .button:visited,
|
||||
body.dark .ui-state-default,
|
||||
body.dark div.content_box_top,
|
||||
body.dark div.hooks tr,
|
||||
body.dark a.translation_call,
|
||||
body.dark div.notification,
|
||||
body.dark div.locale_menu a
|
||||
|
@ -297,15 +297,15 @@ body.dark .button:hover
|
|||
background: linear-gradient(top , #505050, #202020) repeat scroll 0 0 #505050;
|
||||
}
|
||||
/* active gradient */
|
||||
body.dark #top a.goto_nav.active,
|
||||
body.dark .button.active,
|
||||
body.dark .button.active:hover,
|
||||
body.dark .ui-state-active,
|
||||
body.dark .ui-widget-header,
|
||||
body.dark div.pagination span.current,
|
||||
body.dark #top span.new_messages.unread,
|
||||
body.dark div.hooks td.action:hover,
|
||||
body.dark div.hooks table.empty_table tr:hover,
|
||||
body.dark #top a.goto_nav.active,
|
||||
body.dark .button.active,
|
||||
body.dark .button.active:hover,
|
||||
body.dark .ui-state-active,
|
||||
body.dark .ui-widget-header,
|
||||
body.dark div.pagination span.current,
|
||||
body.dark #top span.new_messages.unread,
|
||||
body.dark div.hooks td.action:hover,
|
||||
body.dark div.hooks table.empty_table tr:hover,
|
||||
body.dark div.progressbar.flashy div,
|
||||
body.dark div.locale_menu a.active
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
form.search {
|
||||
margin-top: 10px;
|
||||
padding: 10px 25px;
|
||||
background: #343434;
|
||||
border: 1px solid #3e3e3e;
|
||||
background: #f4f4f4;
|
||||
border: 1px solid #e4e4e4;
|
||||
}
|
||||
|
||||
form.search td {
|
||||
|
|
Loading…
Reference in a new issue