diff --git a/app/controllers/basil_controller.rb b/app/controllers/basil_controller.rb index 06803c4e..a7115012 100644 --- a/app/controllers/basil_controller.rb +++ b/app/controllers/basil_controller.rb @@ -559,16 +559,23 @@ class BasilController < ApplicationController end def help_rate - # Commissions without feedback: + @reviewed_commission_count = BasilFeedback.where(user: current_user).where.not(score_adjustment: nil).count + @reviewed_commission_ids = BasilFeedback.where(user: current_user) - .pluck(:basil_commission_id) - @commissions = BasilCommission.where.not(id: @reviewed_commission_ids) + if params.key?(:rating) + @reviewed_commission_ids = @reviewed_commission_ids.where(score_adjustment: params[:rating].to_i) + else + # Unreviewed commissions + @reviewed_commission_ids = @reviewed_commission_ids.where(score_adjustment: nil) + end + + @commissions = BasilCommission.where(id: @reviewed_commission_ids.pluck(:basil_commission_id)) .where.not(completed_at: nil) .where(user: current_user) .order(created_at: :desc) .limit(50) .includes(:entity) - .shuffle + .order(completed_at: :desc) end def save diff --git a/app/services/basil_service.rb b/app/services/basil_service.rb index c77b771f..8f39cdb8 100644 --- a/app/services/basil_service.rb +++ b/app/services/basil_service.rb @@ -4,7 +4,7 @@ class BasilService < Service def self.enabled_styles_for(page_type) case page_type when 'Character' - %w(realistic painting sketch digital abstract) + %w(realistic painting sketch digital abstract watercolor) when 'Location' %w(realistic painting sketch) when 'Item' @@ -27,7 +27,7 @@ class BasilService < Service def self.experimental_styles_for(page_type) case page_type when 'Character' - %w(realistic2 realistic3 painting2 painting3 horror watercolor anime) + %w(realistic2 realistic3 painting2 painting3 horror anime) else [] end diff --git a/app/views/basil/content.html.erb b/app/views/basil/content.html.erb index f22e92d1..5af1460f 100644 --- a/app/views/basil/content.html.erb +++ b/app/views/basil/content.html.erb @@ -226,7 +226,7 @@ function commission_basil(style) { <% if @commissions.count == 10 %>
-
End of the list?
+
End of the list?

Only your 10 most recent generations are displayed here, but you can still find all of your generated images on the <%= link_to 'Basil Feedback', basil_rating_queue_path %> pages. diff --git a/app/views/basil/help_rate.html.erb b/app/views/basil/help_rate.html.erb index 6d6de1ca..01b72ce6 100644 --- a/app/views/basil/help_rate.html.erb +++ b/app/views/basil/help_rate.html.erb @@ -1,124 +1,210 @@ + + +<% + color_for_rating = { + -2 => 'red lighten-3', + -1 => 'orange lighten-3', + 0 => 'grey lighten-3', + 1 => 'green lighten-3', + 2 => 'blue lighten-3', + 3 => 'red lighten-4', + } +%>

-

<%= number_with_delimiter @reviewed_commission_ids.count %>

+

<%= number_with_delimiter @reviewed_commission_count %>

Images rated
-
-
-
- - You have - <%= 'at least' if @commissions.count >= 50 %> - <%= pluralize @commissions.count, 'generated images' %> - without feedback. - + <% if params.key?(:rating) %> +
+
+ Showing <%= pluralize @commissions.count, 'image' %> you rated + "<%= + case params[:rating].to_i + when -2 then 'Very Bad' + when -1 then 'Bad' + when 0 then 'Meh' + when 1 then 'Good' + when 2 then 'Great' + when 3 then 'Loved' + end + -%>".
-

- Feedback is optional but helps Basil understand what he does well and what he could improve on. - Below are 50 random images of yours that haven't been rated. You can refresh the page at any time for 50 more. - <%= link_to 'View global stats.', basil_stats_path, class: 'orange-text' %> -

-
+ <% else %> +
+
+
+ + You have + <%= 'at least' if @commissions.count >= 50 %> + <%= pluralize @commissions.count, 'generated images' %> + without feedback. + +
+

+ Feedback is optional but helps Basil understand what he does well and what he could improve on. + Below are 50 random images of yours that haven't been rated. You can refresh the page at any time for 50 more. + <%= link_to 'View global stats.', basil_stats_path, class: 'orange-text' %> +

+
+
+ <% end %>
-<% if @commissions.empty? %> -
-

Hurrah, inbox zero!

-
-

- Your images will appear here when you have any that you haven't rated. -

-
-<% end %> +
+
+ <%= link_to '#' do %> +
+ Unrated images +
+ <% end %> -<% @commissions.each do |commission| %> -
- <% if commission.complete? %> - <% - s3 = Aws::S3::Resource.new(region: "us-east-1") - obj = s3.bucket(commission.s3_bucket).object("job-#{commission.job_id}.png") - %> -
-
- <%= link_to obj.presigned_url(:get) do %> - <%= image_tag obj.presigned_url(:get) %> - <% end %> -
-
-
-
- <%= link_to commission.entity.name, basil_content_path(content_type: commission.entity_type, id: commission.entity_id) %> - <% if commission.style? %> - (<%= commission.style.humanize %>) +
+ Your ratings +
+ + <%= link_to basil_rating_queue_path(rating: 3) do %> +
+ Loved images +
+ <% end %> + <%= link_to basil_rating_queue_path(rating: 2) do %> +
+ Very good images +
+ <% end %> + <%= link_to basil_rating_queue_path(rating: 1) do %> +
+ Good images +
+ <% end %> + <%= link_to basil_rating_queue_path(rating: 0) do %> +
+ Meh images +
+ <% end %> + <%= link_to basil_rating_queue_path(rating: -1) do %> +
+ Bad images +
+ <% end %> + <%= link_to basil_rating_queue_path(rating: -2) do %> +
+ Very bad images +
+ <% end %> + +
+ <%= link_to basil_path do %> + chevron_left + Back to Basil + <% end %> +
+
+
+ + <% if @commissions.empty? %> +
+

Hurrah, inbox zero!

+
+

+ Your images will appear here when you have any that you haven't rated. +

+
+ <% end %> + + <% @commissions.each do |commission| %> +
+ <% if commission.complete? %> +
+
+ <%= link_to commission.image do %> + <%= image_tag commission.image %> <% end %>
-
- Completed <%= time_ago_in_words commission.completed_at %> ago - ·
- Took <%= distance_of_time_in_words commission.completed_at - commission.created_at %> -
-
-
Feedback for Basil
-
- <%= form_for commission.basil_feedbacks.find_or_initialize_by(user: current_user), url: basil_feedback_path(commission.job_id), method: :POST, remote: true do |f| %> - <% f.object.score_adjustment = nil if !f.object.persisted? %> -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
+
+
+ <%= link_to commission.entity.name, basil_content_path(content_type: commission.entity_type, id: commission.entity_id) %> + <% if commission.style? %> + (<%= commission.style.humanize %>) <% end %>
+
+ Completed <%= time_ago_in_words commission.completed_at %> ago + · + Took <%= distance_of_time_in_words commission.completed_at - commission.created_at %> +
+
+
Feedback for Basil
+
+ <%= form_for commission.basil_feedbacks.find_or_initialize_by(user: current_user), url: basil_feedback_path(commission.job_id), method: :POST, remote: true do |f| %> + <% f.object.score_adjustment = nil if !f.object.persisted? %> +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ <% end %> +
+
-
-
- <% else %> -
- Basil is still working on this commission... (style: <%= commission.style %>) -
- (Requested <%= time_ago_in_words(commission.created_at) %> ago) -
+ <% else %> +
+ Basil is still working on this commission... (style: <%= commission.style %>) +
+ (Requested <%= time_ago_in_words(commission.created_at) %> ago) +
+
+ <% end %>
<% end %> +
-<% end %> +
+ + + diff --git a/app/views/basil/index.html.erb b/app/views/basil/index.html.erb index 1ac19fac..b8e400fb 100644 --- a/app/views/basil/index.html.erb +++ b/app/views/basil/index.html.erb @@ -11,7 +11,7 @@

NEW: You can also - <%= link_to 'help me get better by leaving feedback', basil_rating_queue_path %>. + <%= link_to 'help Basil get better by leaving feedback', basil_rating_queue_path %>.

@@ -37,8 +37,9 @@
<% if @universe_scope %>
+ <%= Universe.icon %> Showing <%= pluralize @content.count, @content_type %> from <%= @universe_scope.name %>. - <%= link_to 'Show all universes.', basil_content_index_path(@content_type, universe: "all"), class: 'purple-text text-lighten-4' %> + <%= link_to "Show #{@content_type.pluralize.downcase} from all universes instead.", basil_content_index_path(@content_type, universe: "all"), class: 'purple-text text-lighten-4' %>
<% end %> diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 18d30340..4341c3d0 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -127,7 +127,7 @@ <% end %> <% else %> <% - accessible_universes = @current_user_content.fetch('Universe', []) + current_user.contributable_universes + accessible_universes = (@current_user_content.fetch('Universe', []) + current_user.contributable_universes).uniq(&:id) if accessible_universes.count > 1 %>
@@ -155,7 +155,7 @@
<% end %> - <%= render partial: 'notice_dismissal/messages/18' %> + <%= render partial: 'notice_dismissal/messages/20' if show_notice?(id: 20) %>
<% if @recently_edited_pages.any? %> diff --git a/app/views/notice_dismissal/messages/_18.html.erb b/app/views/notice_dismissal/messages/_18.html.erb index 82d100d8..5553777e 100644 --- a/app/views/notice_dismissal/messages/_18.html.erb +++ b/app/views/notice_dismissal/messages/_18.html.erb @@ -1,4 +1,4 @@ -<% if Date.current <= 'December 15, 2022'.to_date && show_notice?(id: 18) %> +<% if Date.current <= 'December 15, 2022'.to_date %>
Happening now diff --git a/app/views/notice_dismissal/messages/_19.html.erb b/app/views/notice_dismissal/messages/_19.html.erb index 241a9a78..cb512adc 100644 --- a/app/views/notice_dismissal/messages/_19.html.erb +++ b/app/views/notice_dismissal/messages/_19.html.erb @@ -13,12 +13,13 @@ simply click a style below. Once the image has generated, you can move it to your <%= link_to @content.try(:name), @content.view_path %> page by clicking "Save" on any image.

-

- celebration - Image generation is a Premium feature, but is free for everyone to use for - the entire month of April. Images created during this time are yours to keep - forever! -

+ <% if Date.current <= 'April 20, 2023'.to_date %> +

+ celebration + Image generation is a Premium feature, but is free for everyone to use until + April 14th. Images created during this time are yours to keep forever! +

+ <% end %>

<%= link_to 'Dismiss this message', notice_dismissal_dismiss_path(notice_id: 19), class: 'right blue-text text-darken-3' %> diff --git a/app/views/notice_dismissal/messages/_20.html.erb b/app/views/notice_dismissal/messages/_20.html.erb new file mode 100644 index 00000000..a1c593ee --- /dev/null +++ b/app/views/notice_dismissal/messages/_20.html.erb @@ -0,0 +1,20 @@ +<% if Date.current <= 'April 15, 2023'.to_date %> +

+
+ See what's new +
+ <%= link_to basil_path do %> +
+
+ camera +
+ Bring your notebook pages to life with our new image generator +
+
+
+ <% end %> +
+ <%= link_to 'dismiss message', notice_dismissal_dismiss_path(notice_id: 20), class: 'right' %> +
+
+<% end %> \ No newline at end of file