Skip to content

Commit

Permalink
adding hardcoded page number to da
Browse files Browse the repository at this point in the history
  • Loading branch information
chapkovski committed Apr 24, 2019
1 parent 147d361 commit 836ed79
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions double_auction/otree_extensions/consumers.py
Expand Up @@ -10,11 +10,11 @@


class MarketTracker(JsonWebsocketConsumer):
url_pattern = r'^/market_channel/(?P<participant_code>.+)$'
url_pattern = r'^/market_channel/(?P<participant_code>.+)/(?P<page_index>\d+)$'

def clean_kwargs(self):
participant = Participant.objects.get(code__exact=self.kwargs['participant_code'])
cur_page_index = participant._index_in_pages
cur_page_index = self.kwargs['page_index']
lookup = ParticipantToPlayerLookup.objects.get(participant=participant, page_index=cur_page_index)
self.player_pk = lookup.player_pk

Expand Down
2 changes: 1 addition & 1 deletion double_auction/pages.py
Expand Up @@ -43,7 +43,7 @@ def vars_for_template(self):
c['bids'] = self.group.get_bids()
c['repository'] = self.player.get_repo_context()
c['contracts'] = self.player.get_contracts_queryset()

c['page_index'] = self.participant._index_in_pages
return c


Expand Down
4 changes: 3 additions & 1 deletion double_auction/static/double_auction/market.css
Expand Up @@ -41,6 +41,8 @@

float: left;
line-height: 0.3em;
font-size: smaller;
white-space: nowrap;
}

.tablecol-4 > tbody > tr > td,
Expand All @@ -51,4 +53,4 @@
.tablecol-2 > tbody > tr > td,
.tablecol-2 > thead > tr > th {
width: 50%;
}
}
Expand Up @@ -5,7 +5,7 @@
};
$(function () {
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
var ws_path = ws_scheme + '://' + window.location.host + "/market_channel/{{ participant.code }}";
var ws_path = ws_scheme + '://' + window.location.host + "/market_channel/{{ participant.code }}/{{ page_index }}";
var socket = new ReconnectingWebSocket(ws_path);


Expand Down
@@ -1,7 +1,7 @@
{% extends 'double_auction/includes/base_block.html' %}
{% block title %}Contracts{% endblock %}
{% block title %}Your contracts{% endblock %}
{% block content %}
<table class="table table-striped header-fixed tablecol-4">
<table class="table table-striped header-fixed tablecol-4 contracts-table">
<thead>
<tr>
<th>
Expand Down
Expand Up @@ -2,6 +2,14 @@
{% block title %}Info:{% endblock %}
{% block content %}
<table class="table-stripped table table-sm table-bordered ">
<tr>
<td>Number of sellers:</td>
<td>{{ subsession.num_sellers }}</td>
</tr>
<tr>
<td>Number of buyers:</td>
<td>{{ subsession.num_buyers }}</td>
</tr>
<tr>
<td>Your role:</td>
<td>{{ player.role|capfirst }}</td>
Expand Down
@@ -1,13 +1,13 @@
{% for r in repository %}
<tr>
<td class="filterable-cell">
<td class="filterable-cell" style="width: 50%">
{% if r.owner.role == 'seller' %}
{{ r.cost }}
{% else %}
{{ r.value }}
{% endif %}
</td>
<td class="filterable-cell">{{ r.quantity|default_if_none:0 }}</td>
<td class="filterable-cell" style="width: 50%">{{ r.quantity|default_if_none:0 }}</td>
</tr>
{% endfor %}

Expand Down
@@ -1,12 +1,12 @@
{% extends 'double_auction/includes/base_block.html' %}
{% block title %}Repository{% endblock %}
{% block title %}Your repository{% endblock %}
{% block content %}
<div class="card">
<table class="table table-striped header-fixed tablecol-2">
<table class="table table-striped header-fixed ">
<thead>
<tr>
<th> {% if player.role == 'buyer' %}Value{% else %}Cost{% endif %}</th>
<th>Quantity</th>
<th style="width: 50%"> {% if player.role == 'buyer' %}Value{% else %}Cost{% endif %}</th>
<th style="width: 50%">Quantity</th>
</tr>
</thead>
<tbody class="repo_container">
Expand Down

0 comments on commit 836ed79

Please sign in to comment.