# HG changeset patch # User ymh # Date 1479249359 -3600 # Node ID 695111d1eec9195239d8389b05e79eb2eb46e4c6 # Parent d8ae6c0c0a0a519041260da88771b0bd7f042ec2 add some test + css adjustments diff -r d8ae6c0c0a0a -r 695111d1eec9 cms/app-client/app/styles/app.scss --- a/cms/app-client/app/styles/app.scss Tue Nov 15 18:27:17 2016 +0100 +++ b/cms/app-client/app/styles/app.scss Tue Nov 15 23:35:59 2016 +0100 @@ -36,6 +36,7 @@ #corpus-app { font-family: sans-serif; font-size: 12px; + line-height: initial; } #corpus-app { diff -r d8ae6c0c0a0a -r 695111d1eec9 cms/app-client/app/styles/tabs/chrono.scss --- a/cms/app-client/app/styles/tabs/chrono.scss Tue Nov 15 18:27:17 2016 +0100 +++ b/cms/app-client/app/styles/tabs/chrono.scss Tue Nov 15 23:35:59 2016 +0100 @@ -1,7 +1,7 @@ #tabs-chrono p { padding: 0px 20px; text-align: center; - margin: 25px 0px 25px 0px; + margin: 15px 0px; line-height: 22px; color: $corpus-black; } diff -r d8ae6c0c0a0a -r 695111d1eec9 cms/app-client/app/styles/tabs/langues.scss --- a/cms/app-client/app/styles/tabs/langues.scss Tue Nov 15 18:27:17 2016 +0100 +++ b/cms/app-client/app/styles/tabs/langues.scss Tue Nov 15 23:35:59 2016 +0100 @@ -91,6 +91,6 @@ #tabs-langues .color-gradient-wrapper .color-gradient { position: relative; width: 100%; - height: 1.75em; + height: 27px; font-size: 0.75em; } diff -r d8ae6c0c0a0a -r 695111d1eec9 server/src/tests/Controllers/DateStatsControllerTest.php --- a/server/src/tests/Controllers/DateStatsControllerTest.php Tue Nov 15 18:27:17 2016 +0100 +++ b/server/src/tests/Controllers/DateStatsControllerTest.php Tue Nov 15 23:35:59 2016 +0100 @@ -42,6 +42,29 @@ ] ] ]; + + $this->ES_QUERY_MINMAX = [ + 'index' => 'corpus', + 'body' => [ + "size" => 0, + "query" => [ "match_all" => (object) null ], + "aggs" => [ + "datestats" => [ + "nested"=> [ + "path" => "creation_years" + ], + "aggs" => [ + "minyear" => [ + "min" => [ "field"=> "creation_years.year" ] + ], + "maxyear" => [ + "max" => [ "field"=> "creation_years.year" ] + ] + ] + ] + ] + ] + ]; } public function tearDown() { @@ -147,4 +170,73 @@ ]]); } + + public function testMinMaxQuery() { + + Es::shouldReceive('search') + ->once() + ->with($this->ES_QUERY_MINMAX) + ->andReturn(json_decode('{ + "took" : 708, + "timed_out" : false, + "_shards" : { + "total" : 1, + "successful" : 1, + "failed" : 0 + }, + "hits" : { + "total" : 0, + "max_score" : 0.0, + "hits" : [ ] + }, + "aggregations" : { + "datestats" : { + "doc_count" : 0, + "maxyear" : { + "value" : null + }, + "minyear" : { + "value" : null + } + } + } + }', true)); + $this->get('/api/v1/stats/dateminmax/')->assertTrue($this->response->isOk(), $this->response->content()); + $this->seeJsonEquals(["dateminmax" => [0, 0]]); + } + + public function testMinMaxResult() { + + Es::shouldReceive('search') + ->once() + ->with($this->ES_QUERY_MINMAX) + ->andReturn(json_decode('{ + "took" : 708, + "timed_out" : false, + "_shards" : { + "total" : 1, + "successful" : 1, + "failed" : 0 + }, + "hits" : { + "total" : 3375, + "max_score" : 0.0, + "hits" : [ ] + }, + "aggregations" : { + "datestats" : { + "doc_count" : 3727, + "maxyear" : { + "value" : 2015.0 + }, + "minyear" : { + "value" : 1948.0 + } + } + } + }', true)); + $this->get('/api/v1/stats/dateminmax/')->assertTrue($this->response->isOk(), $this->response->content()); + $this->seeJsonEquals(["dateminmax" => [ 1948, 2015 ]]); + } + }