Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The frog report #526

Merged
merged 17 commits into from
Jul 11, 2022
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ gem 'bootsnap', '>= 1.4.4', require: false
gem 'listen', '~> 3.3'
gem 'd3-rails', '~> 3.5.5' # we have a very old version of D3. This provides D3 assets.
gem 'cal-heatmap-rails', '~> 3.6' # provides assets for cal heatmap, that requires old d3

# Using this as it wires in via Sprockets and I can't get npm version to work with the main app.
# Had no luck with js/svg approach ;-(
gem 'font-awesome-sass'

gem 'webpacker', '= 5.4.0'
gem 'rack-cors', '~> 1.1'
gem 'foreman'
Expand Down Expand Up @@ -73,3 +77,5 @@ gem 'omniauth-rails_csrf_protection', '~> 1.0'
gem 'omniauth-google-oauth2', '~> 1.0'

gem 'rails-healthcheck', '~> 1.4'

gem 'vega', '~> 0.2.6'
8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ GEM
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
ffi (1.15.3)
font-awesome-sass (5.15.1)
sassc (>= 1.11)
ffi (1.15.5)
font-awesome-sass (6.1.1)
sassc (~> 2.0)
foreman (0.87.2)
gabba (1.0.1)
get_process_mem (0.2.7)
Expand Down Expand Up @@ -371,6 +371,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
uniform_notifier (1.14.2)
vega (0.2.6)
warden (1.2.9)
rack (>= 2.0.9)
webmock (3.14.0)
Expand Down Expand Up @@ -444,6 +445,7 @@ DEPENDENCIES
simplecov
terser
turbolinks (~> 5)
vega (~> 0.2.6)
webmock
webpacker (= 5.4.0)

Expand Down
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web: bundle exec puma -C config/puma.rb
# Enable the worker if you have Google Analytics set up.
#worker: bundle exec sidekiq -e production -C config/sidekiq.yml -q default
#Disable the worker if you don't have Redis and Google Analytics set up.
worker: bundle exec sidekiq -e production -C config/sidekiq.yml -q default
1 change: 0 additions & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -e development -C config/sidekiq.yml -q default
# For the future webpacker: ./bin/webpack-dev-server
6 changes: 4 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@
},
"formation": {
"worker": {
"quantity": 1
"quantity": 1,
"size": "standard-1x"
},
"web": {
"quantity": 1
"quantity": 1,
"size": "standard-1x"
}
},
"name": "quepid",
Expand Down
Binary file added app/assets/images/frog-pond.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/assets/javascripts/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
//= require bootstrap/dist/js/bootstrap.bundle
//= require jquery
//= require cookies_eu

//= require vega
//= require vega-lite
//= require vega-embed
3 changes: 2 additions & 1 deletion app/assets/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ angular.module('QuepidApp', [
'templates',
'ngAnimate',
'countUp',
'ngclipboard'
'ngclipboard',
'ngVega'
]);
39 changes: 39 additions & 0 deletions app/assets/javascripts/components/frog_report/_modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div class="modal-header">
<button type="button" class="close" aria-label="Close" ng-click="ctrl.cancel()"><span aria-hidden="true">&times;</span></button>
<h3 class="modal-title">The Frog Pond Report: <span class="modal-case">{{ ctrl.theCase.caseName }}</span></h3>
</div>
<div class="modal-body frog-pond">
<div class="frog-pond-content">
<p>The accuracy of the scores calculated by Quepid is directly impacted by the number of <i class="fa fa-frog" aria-hidden="true"></i>'s you have. Chase the frogs
back into the pond (i.e rate your documents) so that you can have confidence in the changes you are making!</p>

<h4>Summary</h4>

You have {{ ctrl.theCase.queriesCount}} Queries for this case, which means you need {{ ctrl.totalNumberOfRatingsNeeded() }}
ratings to eliminate all the frogs.<br/>
<span ng-if="ctrl.theCase.lastScore.all_rated">
All the queries have been fully rated! Congratulations!
</span>
<span ng-if="!ctrl.theCase.lastScore.all_rated">
There are {{ ctrl.numberOfMissingRatings() }} ratings missing, leading to {{ ctrl.missingRatingsRate() }}% missing rate.
We recommend maintaining less than 5% ratings missing to have confidence in the scores you are calculating.
<span ng-if="ctrl.missingRatingsRate() > 5">
<br/>
So hop to it!
</span>
</span>
<br/>

<h4 style="margin-top: 80px;">Distribution of Queries Needing Ratings</h4>


<div vega id="chart1" spec="spec"></div>



<br>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ctrl.cancel()">Done</button>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<i class="fa fa-frog" aria-hidden="true"></i>
<a ng-click="ctrl.prompt()">
Report
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

/*jslint latedef:false*/

angular.module('QuepidApp')
.controller('FrogReportCtrl', [
'$uibModal',
'$rootScope',
'$log',
'flash',
'caseSvc',
'queriesSvc',
function (
$uibModal,
$rootScope,
$log,
flash,
caseSvc,
queriesSvc
) {
var ctrl = this;

// Functions
ctrl.prompt = prompt;


function prompt() {
var modalInstance = $uibModal.open({
templateUrl: 'frog_report/_modal.html',
controller: 'FrogReportModalInstanceCtrl',
controllerAs: 'ctrl',
size: 'lg',
resolve: {
theCase: function() {
return caseSvc.getSelectedCase();
},
queriesSvc: function() {
return queriesSvc;
}
}
});

modalInstance.result.then(
function () {
},
function() {
$log.info('INFO: Modal dismissed');
}
);

}
}
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

angular.module('QuepidApp')
.directive('frogReport', [
function () {
return {
restrict: 'E',
controller: 'FrogReportCtrl',
controllerAs: 'ctrl',
templateUrl: 'frog_report/frog_report.html',
scope: {
theCase: '=',
queriesSvc: '=',
iconOnly: '=',
supportsDetailedExport: '='
}
};
}
]);
Loading