diff --git a/hub/services/admin/pricing.py b/hub/services/admin/pricing.py
index b3ba301..1077b68 100644
--- a/hub/services/admin/pricing.py
+++ b/hub/services/admin/pricing.py
@@ -387,10 +387,9 @@ class ExternalPricePlansAdmin(ImportExportModelAdmin):
"plan_name",
"cloud_provider",
"service",
- "currency",
"amount",
"display_compare_to_count",
- "date_retrieved",
+ "replicas",
)
list_filter = ("cloud_provider", "service", "currency", "term")
search_fields = ("plan_name", "cloud_provider__name", "service__name")
diff --git a/hub/services/templates/services/pricelist.html b/hub/services/templates/services/pricelist.html
index e5b5ef7..27ac3c5 100644
--- a/hub/services/templates/services/pricelist.html
+++ b/hub/services/templates/services/pricelist.html
@@ -146,6 +146,7 @@
Compute Plan |
+ Cloud Provider |
vCPUs |
RAM (GB) |
Term |
@@ -167,8 +168,9 @@
{% for row in pricing_data %}
-
+
{{ row.compute_plan }} |
+ {{ row.cloud_provider }} |
{{ row.vcpus }} |
{{ row.ram }} |
{{ row.term }} |
@@ -207,39 +209,61 @@
{% endif %}
{% if show_price_comparison %}
- {% if row.external_comparisons %}
-
- {% for comparison in row.external_comparisons %}
-
- {{ comparison.provider }}: {{ comparison.plan_name }}
- {{ comparison.amount|floatformat:2 }} {{ row.currency }}
- {% if comparison.difference > 0 %}
- +{{ comparison.difference|floatformat:2 }}
- {% elif comparison.difference < 0 %}
- {{ comparison.difference|floatformat:2 }}
- {% endif %}
- {% if comparison.ratio %}
- Price ratio: {{ comparison.ratio|floatformat:2 }}x
- {% endif %}
- {% if comparison.description %}
- {{ comparison.description }}
- {% endif %}
- {% if comparison.vcpus or comparison.ram %}
-
- {% if comparison.vcpus %}{{ comparison.vcpus }} vCPU{% endif %}
- {% if comparison.ram %}{{ comparison.ram }} GB RAM{% endif %}
-
- {% endif %}
-
- {% endfor %}
-
- {% else %}
- No comparisons
- {% endif %}
+ -
|
{% endif %}
{{ row.final_price|floatformat:2 }} |
+ {% if show_price_comparison and row.external_comparisons %}
+ {% for comparison in row.external_comparisons %}
+
+ {{ comparison.plan_name }} |
+ {{ comparison.provider }} |
+
+ {% if comparison.vcpus %}{{ comparison.vcpus }}{% else %}-{% endif %}
+ |
+
+ {% if comparison.ram %}{{ comparison.ram }}{% else %}-{% endif %}
+ |
+ {{ row.term }} |
+ {{ comparison.currency }} |
+ - |
+ - |
+ - |
+ - |
+ - |
+ {% if show_discount_details %}
+ - |
+ - |
+ {% endif %}
+
+
+ {% if comparison.source %}{{ comparison.provider }}{% else %}{{ comparison.provider }}{% endif %}
+ {% if comparison.description %}
+ {{ comparison.description }}
+ {% endif %}
+ {% if comparison.storage %}
+ Storage: {{ comparison.storage }} GB
+ {% endif %}
+ {% if comparison.replicas %}
+ Replicas: {{ comparison.replicas }}
+ {% endif %}
+ {% if comparison.ratio %}
+ Price ratio: {{ comparison.ratio|floatformat:2 }}x
+ {% endif %}
+
+ |
+
+ {{ comparison.amount|floatformat:2 }} {{ comparison.currency }}
+ {% if comparison.difference > 0 %}
+ +{{ comparison.difference|floatformat:2 }}
+ {% elif comparison.difference < 0 %}
+ {{ comparison.difference|floatformat:2 }}
+ {% endif %}
+ |
+
+ {% endfor %}
+ {% endif %}
{% endfor %}
diff --git a/hub/services/views/pricelist.py b/hub/services/views/pricelist.py
index 881bbd7..3f6f6b6 100644
--- a/hub/services/views/pricelist.py
+++ b/hub/services/views/pricelist.py
@@ -16,9 +16,9 @@ def natural_sort_key(name):
def get_external_price_comparisons(plan, appcat_price, currency, service_level):
"""Get external price comparisons for a specific compute plan and service"""
try:
- # Filter by service level if external price has one set
+ # Filter by service level if external price has one set, ignore currency for comparison
external_prices = ExternalPricePlans.objects.filter(
- compare_to=plan, service=appcat_price.service, currency=currency
+ compare_to=plan, service=appcat_price.service
).select_related("cloud_provider")
# Filter by service level if the external price has it configured
@@ -208,29 +208,28 @@ def pricelist(request):
external_prices = get_external_price_comparisons(
plan, appcat_price, currency, service_level
)
-
for ext_price in external_prices:
- price_difference = float(ext_price.amount) - float(
- final_price
- )
- price_ratio = (
- float(ext_price.amount) / float(final_price)
- if final_price > 0
- else None
+ # Calculate price difference using external price currency
+ difference = ext_price.amount - final_price
+ ratio = (
+ ext_price.amount / final_price if final_price > 0 else 0
)
external_comparisons.append(
{
- "provider": ext_price.cloud_provider.name,
"plan_name": ext_price.plan_name,
- "amount": ext_price.amount,
- "difference": price_difference,
- "ratio": price_ratio,
+ "provider": ext_price.cloud_provider.name,
"description": ext_price.description,
+ "amount": ext_price.amount,
+ "currency": ext_price.currency, # Use external price currency
"vcpus": ext_price.vcpus,
"ram": ext_price.ram,
"storage": ext_price.storage,
"replicas": ext_price.replicas,
+ "difference": difference,
+ "ratio": ratio,
+ "source": ext_price.source,
+ "date_retrieved": ext_price.date_retrieved,
}
)