Skip to content

Commit

Permalink
Merge pull request #622 from hdoupe/version_display
Browse files Browse the repository at this point in the history
Remove reference to commit IDs
  • Loading branch information
brittainhard authored Sep 18, 2017
2 parents cdf9503 + 369d182 commit fcee534
Show file tree
Hide file tree
Showing 31 changed files with 351 additions and 115 deletions.
26 changes: 13 additions & 13 deletions deploy/taxbrain_server/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def dropq_task(year, user_mods, first_budget_year, beh_params, tax_data):

#Add taxcalc version to results
vinfo = taxcalc._version.get_versions()
results['taxcalc_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['dropq_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['taxcalc_version'] = vinfo['version']
results['dropq_version'] = vinfo['version']

json_res = json.dumps(results)
return json_res
Expand Down Expand Up @@ -141,8 +141,8 @@ def elasticity_gdp_task_async(year, user_mods, first_budget_year, elast_params):
results = {'elasticity_gdp': gdp_elast_i}
#Add taxcalc version to results
vinfo = taxcalc._version.get_versions()
results['taxcalc_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['dropq_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['taxcalc_version'] = vinfo['version']
results['dropq_version'] = vinfo['version']

json_res = json.dumps(results)
return json_res
Expand All @@ -163,12 +163,12 @@ def ogusa_async(user_mods, ogusa_params, guid):
diff_table = taxcalc.dropq.format_macro_results(diff_data)
results = {'df_ogusa': diff_table}
vinfo = taxcalc._version.get_versions()
results['taxcalc_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['dropq_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['taxcalc_version'] = vinfo['version']
results['dropq_version'] = vinfo['version']

#ogusa uses different version convention
ogvinfo = ogusa._version.get_versions()
ogusa_version = ".".join([ogvinfo['version'], ogvinfo['full-revisionid'][:6]])
ogusa_version = ogvinfo['version']
results['ogusa_version'] = ogusa_version
json_res = json.dumps(results)
return json_res
Expand All @@ -189,10 +189,10 @@ def btax_async(user_mods):
else:
results.update(tables)
vinfo = taxcalc._version.get_versions()
results['taxcalc_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['dropq_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['taxcalc_version'] = vinfo['version']
results['dropq_version'] = vinfo['version']
binfo = btax._version.get_versions()
results['btax_version'] = binfo['version'] + '.' + binfo['full-revisionid'][:6]
results['btax_version'] = binfo['version']
return json.dumps(results)


Expand All @@ -208,13 +208,13 @@ def example_async():

#Add version to results
vinfo = taxcalc._version.get_versions()
results['taxcalc_version'] = vinfo['version'] + '.' + vinfo['full'][:6]
results['taxcalc_version'] = vinfo['version']
dqvinfo = taxcalc.dropq._version.get_versions()
results['dropq_version'] = vinfo['version'] + '.' + dqvinfo['full'][:6]
results['dropq_version'] = vinfo['version']

#ogusa uses different version convention
ogvinfo = ogusa._version.get_versions()
ogusa_version = ".".join([ogvinfo['version'], ogvinfo['full-revisionid'][:6]])
ogusa_version = ogvinfo['version']
results['ogusa_version'] = ogusa_version
json_res = json.dumps(results)
return json_res
Expand Down
8 changes: 6 additions & 2 deletions templates/btax/input_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ <h2>About Cost of Capital Calculator</h2>
{% flatblock "ccc_what_is_ccc_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/B-Tax">Version {{ btax_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>B-Tax Code Build</h2>
<p><a href="https://github.com/open-source-economics/B-Tax/tree/{{btax_version}}">Version {{ btax_version }} - GitHub</a></p>
</div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion templates/btax/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<h1>{% flatblock "ccc_results_header" %}</h1>
</div>

<p class="meta">These results were generated on {{ created_on|date:"D, M jS Y \a\t g:iA" }}<br>B-Tax <a href="/apps">version {{ unique_url.btax_vers }}</a> <br>Taxcalc <a href="/apps">version {{ unique_url.taxcalc_vers }}</a></p>
<p class="meta">These results were generated by <a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}"> PolicyBrain version {{ webapp_version }}</a> on {{ created_on|date:"D, M jS Y \a\t g:iA" }} UTC using <a href="https://github.com/open-source-economics/B-Tax/tree/{{btax_version}}"> B-Tax version {{ btax_version }}.</a> </p>

<a href="/ccc/edit/{{ unique_url.pk }}/" class="text-white btn btn-secondary">Edit Parameters</a>
</div>
Expand Down
9 changes: 6 additions & 3 deletions templates/dynamic/behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ <h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator">Version {{ taxcalc_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
</div>

<form class="inputs-form" method="post" action="/dynamic/behavioral/{{pk}}/?start_year={{start_year}}">
{% csrf_token %}
Expand Down
14 changes: 10 additions & 4 deletions templates/dynamic/dynamic_input_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ <h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator">Version {{ taxcalc_version }} - GitHub</a></p>
<p><a href="https://github.com/open-source-economics/OG-USA">Version {{ ogusa_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>OG-USA Code Build</h2>
<p><a href="https://github.com/open-source-economics/OG-USA/tree/{{ogusa_version}}">Version {{ ogusa_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
</div>

<form class="inputs-form" method="post" action="/dynamic/ogusa/{{pk}}/?start_year={{start_year}}">
{% csrf_token %}
Expand Down
9 changes: 6 additions & 3 deletions templates/dynamic/elasticity.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ <h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator">Version {{ taxcalc_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
</div>

<form class="inputs-form" method="post" action="/dynamic/macro/{{pk}}/?start_year={{start_year}}">
{% csrf_token %}
Expand Down
15 changes: 9 additions & 6 deletions templates/dynamic/elasticity_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ <h2 class="sr-only">TaxBrain</h2>
<section class="taxbrain-info collapse" id="taxbrainInfo">
<div class="container">
<div class="taxbrain-history">
<h2>Our History</h2>
<h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/Tax-Calculator">Version {{ unique_url.taxcalc_vers }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
</div>


<div class="result-header">
<div class="result-header-control">
<h1>{% flatblock "elasticity_results_header" %}</h1>
Expand All @@ -59,7 +62,7 @@ <h1>{% flatblock "elasticity_results_header" %}</h1>
</ul>
</div>
</div>
<p class="meta">These results were generated on {{ created_on|date:"D, M jS Y \a\t g:iA" }} using <a href="#">version {{ unique_url.taxcalc_vers }}</a> TaxBrain. (ID: 10045)</p>
<p class="meta">These results were generated by <a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}"> PolicyBrain version {{ webapp_version }}</a> on {{ created_on|date:"D, M jS Y \a\t g:iA" }} UTC using <a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}"> Tax-Calculator version {{ taxcalc_version }}.</a> </p>
<p class="meta">The microsimulation upon which this dynamic simulation was based can be found <a href="{{microsim_url}}">here</a> </p>
<a href="/dynamic/macro/edit/{{ unique_url.pk }}/?start_year={{ first_year }}" class="text-white btn btn-secondary">Edit Parameters</a>
</div>
Expand Down
9 changes: 6 additions & 3 deletions templates/dynamic/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ <h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator">Version {{ taxcalc_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
</div>

<form class="inputs-form" method="post" action="/dynamic/{{pk}}/?start_year={{start_year}}">
{% csrf_token %}
Expand Down
12 changes: 8 additions & 4 deletions templates/dynamic/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ <h2 class="sr-only">TaxBrain</h2>
<section class="taxbrain-info collapse" id="taxbrainInfo">
<div class="container">
<div class="taxbrain-history">
<h2>Our History</h2>
<h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/Tax-Calculator">Version {{ unique_url.taxcalc_vers }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
Expand All @@ -43,7 +47,7 @@ <h2>Code Build</h2>
<div class="result-header-control">
<h1>{% flatblock "dynamic_results_header" %} {{ tables.result_years.0 }} - {{ tables.result_years | last }} </h1>
</div>
<p class="meta">These results were generated on {{ created_on|date:"D, M jS Y \a\t g:iA" }} using <a href="https://anaconda.org/ospc/ogusa">version {{ ogusa_version }}</a> of the OGUSA package. (ID: 10045)</p>
<p class="meta">These results were generated by <a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}"> PolicyBrain version {{ webapp_version }}</a> on {{ created_on|date:"D, M jS Y \a\t g:iA" }} UTC using <a href="https://github.com/open-source-economics/OG-USA/tree/{{ogusa_version}}">Version {{ ogusa_version }}</a> </p>
<p class="meta">The microsimulation upon which this dynamic simulation was based can be found <a href="{{microsim_url}}">here</a> </p>
</div>

Expand Down
4 changes: 2 additions & 2 deletions templates/pages/apps.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ <h2>About B-Tax (Cost of Capital)</h2>
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator">Tax-Calculator Version {{ taxcalc_version }} - GitHub</a></p>
<p><a href="https://github.com/open-source-economics/B-Tax">B-Tax (Cost of Capital) Version {{ btax_version }} - GitHub</a></p>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Tax-Calculator Version {{ taxcalc_version }} - GitHub</a></p>
<p><a href="https://github.com/open-source-economics/B-Tax/tree/{{btax_version}}">B-Tax (Cost of Capital) Version {{ btax_version }} - GitHub</a></p>
<p><a href="/about">More Information</a></p>
</div>
</div>
Expand Down
16 changes: 12 additions & 4 deletions templates/taxbrain/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ <h2>About Cost of Capital Calculator</h2>
{% flatblock "ccc_what_is_ccc_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/open-source-economics/B-Tax">Version {{ btax_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>B-Tax Code Build</h2>
<p><a href="https://github.com/open-source-economics/B-Tax/tree/{{btax_version}}">Version {{ btax_version }} - GitHub</a></p>
</div>
</div>
</section>
Expand All @@ -50,8 +54,12 @@ <h2>Our History</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/Tax-Calculator">Version {{ unique_url.taxcalc_vers }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
Expand Down
8 changes: 6 additions & 2 deletions templates/taxbrain/input_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ <h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/Tax-Calculator">Version {{ taxcalc_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
Expand Down
8 changes: 6 additions & 2 deletions templates/taxbrain/input_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ <h2>About TaxBrain</h2>
{% flatblock "taxbrain_what_is_taxbrain_dropdown" %}
</div>
<div class="taxbrain-build">
<h2>Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/Tax-Calculator">Version {{ taxcalc_version }} - GitHub</a></p>
<h2>PolicyBrain Code Build</h2>
<p><a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}">Version {{ webapp_version }} - GitHub</a></p>
</div>
<div class="taxbrain-build">
<h2>Tax-Calculator Code Build</h2>
<p><a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}">Version {{ taxcalc_version }} - GitHub</a></p>
</div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion templates/taxbrain/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1>{% flatblock "taxbrain_static_results_header" %}</h1>
<h1>{% flatblock "taxbrain_pe_results_header" %}</h1>
{% endif %}
</div>
<p class="meta">These results were generated on {{ created_on|date:"D, M jS Y \a\t g:iA" }} using <a href="#">version {{ unique_url.taxcalc_vers }}</a> TaxBrain. (ID: 10045)</p>
<p class="meta">These results were generated by <a href="https://github.com/OpenSourcePolicyCenter/webapp-public/tree/v{{webapp_version}}"> PolicyBrain version {{ webapp_version }}</a> on {{ created_on|date:"D, M jS Y \a\t g:iA" }} UTC using <a href="https://github.com/open-source-economics/Tax-Calculator/tree/{{taxcalc_version}}"> Tax-Calculator version {{ taxcalc_version }}.</a> </p>
{% if quick_calc %}
<p class="meta">This calculation used only 2% of the available data and only calculated revenues for one year instead of ten. For the full results, <a href="/taxbrain/submit/{{ unique_url.pk }}/">click here</a></p>

Expand Down
3 changes: 1 addition & 2 deletions webapp/apps/btax/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


BTAX_VERSION_INFO = btax._version.get_versions()
BTAX_VERSION = ".".join([BTAX_VERSION_INFO['version'], BTAX_VERSION_INFO['full-revisionid'][:6]])
BTAX_VERSION = BTAX_VERSION_INFO['version']


#
Expand Down Expand Up @@ -210,4 +210,3 @@ def group_args_to_btax_depr(btax_default_params, asset_yr_str):

)
return depr_argument_groups

19 changes: 19 additions & 0 deletions webapp/apps/btax/migrations/0002_btaxoutputurl_webapp_vers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('btax', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='btaxoutputurl',
name='webapp_vers',
field=models.CharField(default=None, max_length=50, null=True, blank=True),
),
]
3 changes: 3 additions & 0 deletions webapp/apps/btax/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class BTaxOutputUrl(models.Model):
uuid = UUIDField(auto=True, default=None, null=True)
btax_vers = models.CharField(blank=True, default=None, null=True, max_length=50)
taxcalc_vers = models.CharField(blank=True, default=None, null=True, max_length=50)
webapp_vers = models.CharField(blank=True, default=None, null=True,
max_length=50)

def get_absolute_url(self):
kwargs = {
'pk': self.pk
Expand Down
2 changes: 1 addition & 1 deletion webapp/apps/btax/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BTaxViewsTests(TestCase):
expected_results_tokens = ['cost of capital', 'change from reform',
'baseline', 'reform',
'industry', 'asset', 'accommodation',
'typically financed', 'were generated on']
'typically financed', 'were generated by']
def setUp(self):
# Every test needs a client.
self.client = Client()
Expand Down
Loading

0 comments on commit fcee534

Please sign in to comment.