Commit 86f654de authored by opelhoward's avatar opelhoward
Browse files

ini yang baru 2

parent abc99d4c
......@@ -27,8 +27,8 @@
<file leaf-file-name="sconnectionhandler.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/sconnectionhandler.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.51428574" vertical-offset="1349" max-vertical-offset="8806">
<caret line="91" column="40" selection-start-line="91" selection-start-column="40" selection-end-line="91" selection-end-column="40" />
<state vertical-scroll-proportion="0.42696628" vertical-offset="6580" max-vertical-offset="8823">
<caret line="396" column="73" selection-start-line="396" selection-start-column="73" selection-end-line="396" selection-end-column="73" />
<folding>
<element signature="e#21#32#0" expanded="true" />
</folding>
......@@ -49,7 +49,7 @@
<file leaf-file-name="inventory.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/inventory.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="408">
<state vertical-scroll-proportion="0.0" vertical-offset="289" max-vertical-offset="408">
<caret line="17" column="58" selection-start-line="17" selection-start-column="58" selection-end-line="17" selection-end-column="58" />
<folding />
</state>
......@@ -93,7 +93,7 @@
<file leaf-file-name="market.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/market.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1122">
<state vertical-scroll-proportion="0.0" vertical-offset="136" max-vertical-offset="1122">
<caret line="8" column="23" selection-start-line="8" selection-start-column="23" selection-end-line="8" selection-end-column="23" />
<folding>
<element signature="e#22#53#0" expanded="true" />
......@@ -382,7 +382,7 @@
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
<editor active="true" />
<editor active="false" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24304539" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
......@@ -391,7 +391,7 @@
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32913387" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32913387" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
......@@ -426,6 +426,68 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/inventory.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="289" max-vertical-offset="408">
<caret line="17" column="58" selection-start-line="17" selection-start-column="58" selection-end-line="17" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sclient.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="120" max-vertical-offset="2125">
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<folding>
<element signature="e#0#23#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tradebox.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="871" max-vertical-offset="1275">
<caret line="59" column="0" selection-start-line="59" selection-start-column="0" selection-end-line="59" selection-end-column="0" />
<folding>
<element signature="e#22#53#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://C:/Python34/Lib/site-packages/bson/objectid.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="3132" max-vertical-offset="4845">
<caret line="205" column="0" selection-start-line="205" selection-start-column="0" selection-end-line="205" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/market.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="136" max-vertical-offset="1122">
<caret line="8" column="23" selection-start-line="8" selection-start-column="23" selection-end-line="8" selection-end-column="23" />
<folding>
<element signature="e#22#53#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ssocketio.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="656" max-vertical-offset="1054">
<caret line="41" column="38" selection-start-line="41" selection-start-column="33" selection-end-line="41" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/user.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="554" max-vertical-offset="1207">
<caret line="63" column="32" selection-start-line="63" selection-start-column="32" selection-end-line="63" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sconnectionhandler.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="161" max-vertical-offset="8772">
......@@ -774,16 +836,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/market.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1122">
<caret line="8" column="23" selection-start-line="8" selection-start-column="23" selection-end-line="8" selection-end-column="23" />
<folding>
<element signature="e#22#53#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://C:/Python34/Lib/site-packages/bson/objectid.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="3132" max-vertical-offset="4845">
......@@ -810,10 +862,20 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/market.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1122">
<caret line="8" column="23" selection-start-line="8" selection-start-column="23" selection-end-line="8" selection-end-column="23" />
<folding>
<element signature="e#22#53#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sconnectionhandler.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.51428574" vertical-offset="1349" max-vertical-offset="8806">
<caret line="91" column="40" selection-start-line="91" selection-start-column="40" selection-end-line="91" selection-end-column="40" />
<state vertical-scroll-proportion="0.42696628" vertical-offset="6580" max-vertical-offset="8823">
<caret line="396" column="73" selection-start-line="396" selection-start-column="73" selection-end-line="396" selection-end-column="73" />
<folding>
<element signature="e#21#32#0" expanded="true" />
</folding>
......
......@@ -260,7 +260,7 @@ class ConnectionHandler:
thread_list = []
# untuk setiap server lain
if Market.dirty(item):
if True:#Market.dirty(item):
Market.clear(item)
for other_server in self._server._server_list:
host = other_server.get('ip')
......@@ -323,7 +323,6 @@ class ConnectionHandler:
# invoke accept
def handle_accept(self,offer_token):
data = ''
print("woi "+offer_token)
if (Tradebox.exist(offer_token)):
offer = Tradebox.find_offer_id(offer_token)
if offer.availability:
......@@ -344,7 +343,6 @@ class ConnectionHandler:
def handle_sendaccept(self, token, offer_token):
data = ''
print(token+' '+offer_token)
if (not Market.exist(offer_token)):
data = json.dumps({'status': 'fail', 'description': 'offer cannot be found'})
else:
......@@ -376,6 +374,7 @@ class ConnectionHandler:
if (target_response.get('status') == 'ok'):
user.inventory.items[offer.demanded_id] -= offer.demanded_amount
user.inventory.items[offer.offered_id] += offer.offered_amount
user.save()
data = (json.dumps({'status':'ok'})).encode('ascii')
#call db
elif (target_response.get('status') == 'fail'):
......@@ -391,13 +390,15 @@ class ConnectionHandler:
# invoke map
def handle_fetchitem(self,token,offer_token):
print(token+' '+offer_token)
offer = Tradebox.find_offer_id(offer_token)
if (offer.user_id == token) and (offer.availability):
if (offer.user_id == token) and (not offer.availability):
user = User(token)
user.inventory.items[offer.demanded_id] += offer.demanded_amount
user.save()
offer.availability = False
offer.save()
offer.delete()
data = json.dumps({'status':'ok'})
else:
data = json.dumps({'status':'fail','description': 'FAILURE MESSAGE HERE'})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment