Skip to content

Commit

Permalink
Merge pull request #3595 from nilbus/flipper-cleanup
Browse files Browse the repository at this point in the history
Feature cleanup
  • Loading branch information
Katrina Owen committed Jul 25, 2017
2 parents 6fac0ba + 8cdac8e commit e1ad72b
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 72 deletions.
2 changes: 0 additions & 2 deletions api/v1/routes/iterations.rb
Expand Up @@ -140,8 +140,6 @@ class Iterations < Core
private

def what_next_instructions(attempt)
return '' unless $flipper['cli_call_to_action'].enabled?(attempt.user)

track = attempt.iteration.track_id
exercise = attempt.iteration.slug
url = File.join('http://', site_root, 'tracks', track, 'exercises', exercise)
Expand Down
31 changes: 13 additions & 18 deletions app/routes/stats.rb
Expand Up @@ -2,24 +2,19 @@ module ExercismWeb
module Routes
class Stats < Core
get '/stats' do
if $flipper[:participation_stats].enabled?(current_user)
tracks = Trackler.tracks.reject {|track| track.implementations.count.zero? }.sort_by(&:language)
stats = {
experimental: ParticipationStats.new(experiment_group: :experimental).results,
control: ParticipationStats.new(experiment_group: :control).results
}
experiment_past_date = Date.parse(ParticipationStats::GAMIFICATION_EXPERIMENT_END_DATE) + 1.day
erb :"stats/participation", locals: {
tracks: tracks,
stats: stats,
experiment_complete_date: (experiment_past_date).strftime('%A, %b %e, %Y'),
experiment_completed: ParticipationStats.experiment_complete?,
user_may_see_early: !current_user.guest? && current_user.motivation_experiment_opt_out?,
}
else
track = Trackler.tracks.sort_by(&:language).find(&:active?)
redirect "/stats/%s" % track.id
end
tracks = Trackler.tracks.reject {|track| track.implementations.count.zero? }.sort_by(&:language)
stats = {
experimental: ParticipationStats.new(experiment_group: :experimental).results,
control: ParticipationStats.new(experiment_group: :control).results
}
experiment_past_date = Date.parse(ParticipationStats::GAMIFICATION_EXPERIMENT_END_DATE) + 1.day
erb :"stats/participation", locals: {
tracks: tracks,
stats: stats,
experiment_complete_date: (experiment_past_date).strftime('%A, %b %e, %Y'),
experiment_completed: ParticipationStats.experiment_complete?,
user_may_see_early: !current_user.guest? && current_user.motivation_experiment_opt_out?,
}
end

put '/stats/motivation-experiment-opt-out' do
Expand Down
6 changes: 1 addition & 5 deletions app/routes/submissions.rb
Expand Up @@ -15,11 +15,7 @@ class Submissions < Core

title("%s by %s in %s" % [submission.problem.name, submission.user.username, submission.problem.language])

comment_history = if current_user.guest? || !$flipper[:comment_history].enabled?(current_user)
[]
else
current_user.comments.recent($flipper[:less_comment_history].enabled?(current_user) ? 25 : 50)
end
comment_history = current_user.guest? ? [] : current_user.comments.recent(50)

locals = {
submission: submission,
Expand Down
8 changes: 3 additions & 5 deletions app/views/stats/index.erb
Expand Up @@ -4,11 +4,9 @@
<aside class="col-md-4">
<nav class="stats">
<ul class="nav nav-stacked nav-bordered">
<% if $flipper[:participation_stats].enabled?(current_user) %>
<li>
<a href="/stats">Overview</a>
</li>
<% end %>
<li>
<a href="/stats">Overview</a>
</li>
<% tracks.each do |t|%>
<li class="<%= 'active' if t.id==track.id%>">
<a href="/stats/<%= t.id %>">
Expand Down
3 changes: 1 addition & 2 deletions app/views/submissions/comment.erb
Expand Up @@ -6,7 +6,6 @@
name="body"
class="comment form-control"
rows="8"
placeholder="<%= VariedResponses.sentence_starter if $flipper[:sentence_starters].enabled?(current_user) %>"
data-submission-key="<%= submission.key %>"
ng-model="data.body"
<%= "ng-init=\"data.body='#{ng_esc(nit.body)}'\"" if defined? nit %>></textarea>
Expand All @@ -15,7 +14,7 @@
<div class="preview" ng-bind-html-unsafe="data.preview"></div>
<hr>
</tab>
<% if $flipper[:comment_history].enabled?(current_user) && !locals[:comment_history].blank? %>
<% if locals[:comment_history].present? %>
<tab heading="History" class="hidden history_tab">
<h5>Select a comment to insert as a starting point</h5>
<div class="list-group">
Expand Down
26 changes: 12 additions & 14 deletions app/views/submissions/current_submission.erb
Expand Up @@ -50,19 +50,17 @@
<% end %>
</div>

<% if $flipper[:prompts].enabled?(current_user) %>
<div class="submission-prompt bs-callout bs-callout-primary hidden">
<h4>
Food for thought
<span class="btn-new-prompt">
<i class="fa fa-refresh" aria-label="Give me another idea…" title="Give me another idea…"></i>
</span>
</h4>
<p class="prompt-text"></p>
<button class="btn-answer-prompt btn btn-xs btn-primary">
comment <i class="fa fa-angle-double-right" aria-hidden="true"></i>
</button>
</div>
<% end %>
<div class="submission-prompt bs-callout bs-callout-primary hidden">
<h4>
Food for thought
<span class="btn-new-prompt">
<i class="fa fa-refresh" aria-label="Give me another idea…" title="Give me another idea…"></i>
</span>
</h4>
<p class="prompt-text"></p>
<button class="btn-answer-prompt btn btn-xs btn-primary">
comment <i class="fa fa-angle-double-right" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
1 change: 0 additions & 1 deletion lib/exercism.rb
Expand Up @@ -47,7 +47,6 @@
require 'exercism/user_finished_tracks'
require 'exercism/user_lookup'
require 'exercism/user_tracks_summary'
require 'exercism/varied_responses'
require 'exercism/view'
require 'exercism/watermark'

Expand Down
14 changes: 0 additions & 14 deletions lib/exercism/varied_responses.rb

This file was deleted.

1 change: 0 additions & 1 deletion test/api/assignments_test.rb
Expand Up @@ -12,7 +12,6 @@ def app
attr_reader :alice
def setup
super
$flipper['cli_call_to_action'].enable
@alice = User.create(username: 'alice', github_id: 1)
Language.instance_variable_set(:"@by_track_id", "fake" => "Fake")
end
Expand Down
1 change: 0 additions & 1 deletion test/app/stats_test.rb
Expand Up @@ -34,7 +34,6 @@ def setup
super
@alice = User.create!(alice_attributes)
@opted_out = User.create!(opted_out_attributes)
$flipper[:participation_stats].enable
end

def assert_response_status(expected_status)
Expand Down
9 changes: 0 additions & 9 deletions test/exercism/varied_responses_test.rb

This file was deleted.

0 comments on commit e1ad72b

Please sign in to comment.