Modelling DB Structure - Rails - ruby-on-rails

I have a product model wherein the user can customise the product being selected. The user can actually customise the product on two fronts namely size and color. Size options as of now is currently of two types namely size1 and size2. Color options are also similar to that of size where user can select between Black and White irrespective of frame size chosen for now. How can the variant data be modelled effectively in a rails environment? I am looking for the best solution keeping in mind the options for both size and color might grow in the near future. Please let me know what would be the best way to address this?

Here is a class diagram which can help you understand how you should build relationship.
Size and Color will be option_types, size1, size2, Black, White etc will go into option_values
variants with option_value_variants will hold variants like Black Shirt of Size1

Related

Conditional formatting color scale - second highest value as maxpoint?

I have a table with values in it. I want to be able to immediately spot the cells with the biggest values. Using the color scale tool works nicely as demonstrated below
However, with my real data, there are a few cells that have huge values in it - these then raise the maxpoint so high that the formatting kind of breaks for the other values since in relation to the maxpoint, the other values are very small, making the colors among them almost indistinguishable.
I have obtained the second-highest value by doing =large(A1:C3,2) in an unrelated cell - however I seem to be unable to reference that cell in the Maxpoint setting. Is there a way?
Another idea was to manually set up a color scale that is more logarithmic in its curve but this really isn't a nice option I think. The only option that's left that I can think of is to dynamically color the cells via a script - is there already an easier or existing solution?
try like this:
=LARGE($A$1:$C$3; 2)

how to show YOY metric values as text in a tableau viz

please click here for the image
2 questions to the Tableau Sanseis:
The given percentages/numbers in the attachment (shown by parentheses), all belong to the YOY variance and are meant to be displayed in front of the orange (2021) bars
a) Both the numbers/percentages are not showing in one line and current display gives the impression to a user that %ages belong to the blue bars and number to the orange colored bars.
- How to show both in front of orange bars ?
b) Beats me as to why some of the category bars (highlighted with red arrows) don't display any value (no %ages or numbers)
Thanks in advance
Probably "between" your two measure there's some CR, so you see one up and the other down, causing to display just some values and not all.
Something like this:
Go into the Text Mark of your worksheet, and try to dispay your values in just one line with no CR, and you should get something like this:
Sometimes, due to font size and cardinality of your data, some label could be missing just because Tableau tries to optimize the rendering, but you can also check the last option of the Label Mark selecting "Allow Labels to overlap other marks".

Spree: How to let the user choose variants by their options separately (size and color)?

Say I have a shoe store. A shoe can come in maybe three colors, and maybe 10 sizes (half steps ranging from 7 to 12).
Spree's default behavior is to display a list of 30 variants: Red, Size 7; Green, Size 7; Blue, Size 7; Red, Size 7.5; Green, Size 7.5; etc.
UI-wise, it makes a lot more sense to display the variant options in two dimensions – a dropdown list for size, and a dropdown list for color – and I imagine this is how 99% of merchants display this kind of information on their product pages.
Is there any easy way to do this within Spree, or am I better off doing this client-side in JavaScript? I'm new to Rails but experienced in JS, so while I'm capable of building this client-side, I figure this can't be that uncommon of a use-case and I must be just overlooking something.
Thanks!

Item color picker/swapper

Let's say I have two products: iPhone 5 64GB (White) and iPhone 5 64GB (Black).
What's the best way to create a color picker/swapper if the names of the items include the color (which unfortunately cannot be changed)?
Ideally, the items should display once (as iPhone 5 64GB) and show a select box with options of White and Black.
In addition to the color being displayed in the item's name, there is also a color attribute in the database.
My initial thought was to have regex exclude everything inside the parentheses, then compare the names of the items to see if they match. If they do, grab each color from the database and add the options to a select box.
However, I am not sure if this is the right approach so I'm seeking advice from the experts!
Ideally your database will contain data in a meaningful and structured way. If for some reason your data cannot be massaged into a clean schema, you're left to handle the data in your app (using regex or other methods as you suggest) in order to get it into the format that you need.
In the case presented here it sounds like you'll need to query your database to get the ipod entries and then filter / process these entries as necessary in your app.

Getting Polygons to display multiple variables using a stripped color scheme in ArcMap

I am creating a map in which i want a polygon to display two separate variables within it. Therefore I want a stripped polygon relating to both the keys from the separate factors however I have no idea on how to do this. I messed around with multiple attributes on the properties section and could get the two variables up however could see no way of making the polygon display them both.
Thank you, any help would be appreciated
This is partially manual, but you are going to have to make a separate category within one of the fields that identifies the multivariate features. You could also create a new layer that is a selection of these features. Once you have that, go to the layer properties and display the features as 'Categories - Unique values, many fields' and hit the 'Add All Values' button. Once the categories are populated select the one you are interested in and pick a hatched symbol such as 'Radiation Overlay'. Then go to the Symbol Property Editor (double-click the symbol) and modify the two layers that make up the hatched symbol. You need to adjust the color, line thickness, offset, etc. until you get it to look the way you want. Probably not as auto as you wanted, but it will satisfy display purposes.

Resources