From f43d20df70bb5d23aa6ab0f84a157a38856c10a4 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 23 May 2014 15:19:07 +0100 Subject: Add visible_request_count to /version.json --- app/controllers/general_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 6f0d29889..861f90c9d 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -178,7 +178,8 @@ class GeneralController < ApplicationController format.json { render :json => { :alaveteli_git_commit => alaveteli_git_commit, :alaveteli_version => ALAVETELI_VERSION, - :ruby_version => RUBY_VERSION + :ruby_version => RUBY_VERSION, + :visible_request_count => InfoRequest.visible.count }} end end -- cgit v1.2.3 From ab2b025d6d095cd75ee19113d33e05d30ad0f455 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 23 May 2014 15:27:40 +0100 Subject: Add confirmed_user_count to /version.json --- app/controllers/general_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 861f90c9d..e2a2190b0 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -179,7 +179,8 @@ class GeneralController < ApplicationController :alaveteli_git_commit => alaveteli_git_commit, :alaveteli_version => ALAVETELI_VERSION, :ruby_version => RUBY_VERSION, - :visible_request_count => InfoRequest.visible.count + :visible_request_count => InfoRequest.visible.count, + :confirmed_user_count => User.where(:email_confirmed => true).count }} end end -- cgit v1.2.3 From 42870985da06418461c847563fa860c11b4094a1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 10 Jun 2014 10:04:29 +0100 Subject: Rename XXX comments with TODO: Picks these up in `rake notes` and adds semantic meaning --- app/controllers/general_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index e2a2190b0..28055ddbf 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -59,7 +59,7 @@ class GeneralController < ApplicationController # Actual search def search - # XXX Why is this so complicated with arrays and stuff? Look at the route + # TODO: Why is this so complicated with arrays and stuff? Look at the route # in config/routes.rb for comments. combined = params[:combined].split("/") @sortby = nil @@ -70,7 +70,7 @@ class GeneralController < ApplicationController else @advanced = false end - # XXX currently /described isn't linked to anywhere, just used in RSS and for /list/successful + # TODO: currently /described isn't linked to anywhere, just used in RSS and for /list/successful # This is because it's confusingly different from /newest - but still useful for power users. if combined.size > 0 && (['newest', 'described', 'relevant'].include?(combined[-1])) @sort_postfix = combined.pop @@ -124,7 +124,7 @@ class GeneralController < ApplicationController end end - # Query each type separately for separate display (XXX we are calling + # Query each type separately for separate display (TODO: we are calling # perform_search multiple times and it clobbers per_page for each one, # so set as separate var) requests_per_page = params[:requests_per_page] ? params[:requests_per_page].to_i : 25 -- cgit v1.2.3 From 4d9c89d0e416825eb52a720d74230f547454ba31 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 30 May 2014 15:48:10 +0100 Subject: Use regex based highlighting --- app/controllers/general_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 28055ddbf..759e80af9 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -159,7 +159,7 @@ class GeneralController < ApplicationController end # Spelling and highight words are same for all three queries - @highlight_words = @request_for_spelling.words_to_highlight + @highlight_words = @request_for_spelling.words_to_highlight(:regex => true) if !(@request_for_spelling.spelling_correction =~ /[a-z]+:/) @spelling_correction = @request_for_spelling.spelling_correction end -- cgit v1.2.3 From f23b89f3474847cdd14ba892c5a7259964e18148 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 24 Jun 2014 16:08:32 +0100 Subject: Handle unhelpful stemming Stemming returns 'bore' as the word to highlight which can't be matched in the original phrase. Also removes duplicates from the results --- app/controllers/general_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/general_controller.rb') diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 759e80af9..158492eb2 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -159,7 +159,7 @@ class GeneralController < ApplicationController end # Spelling and highight words are same for all three queries - @highlight_words = @request_for_spelling.words_to_highlight(:regex => true) + @highlight_words = @request_for_spelling.words_to_highlight(:regex => true, :include_original => true) if !(@request_for_spelling.spelling_correction =~ /[a-z]+:/) @spelling_correction = @request_for_spelling.spelling_correction end -- cgit v1.2.3