Commit 44c61ce3 authored by Timothy Pratama's avatar Timothy Pratama
Browse files

Merge branch 'master' of...

Merge branch 'master' of http://gitlab.informatika.org/timothy.pratama/IF3230-Tugas-Besar-Sister-2015.git
parents 4b6b8970 6dd0c9ef
......@@ -24,11 +24,11 @@
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="sconnectionhandler.py" pinned="false" current-in-tab="false">
<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.0" vertical-offset="3440" max-vertical-offset="8823">
<caret line="221" column="22" selection-start-line="221" selection-start-column="22" selection-end-line="221" selection-end-column="22" />
<state vertical-scroll-proportion="-0.76623374" vertical-offset="3525" max-vertical-offset="8823">
<caret line="190" column="56" selection-start-line="190" selection-start-column="56" selection-end-line="190" selection-end-column="56" />
<folding>
<element signature="e#21#32#0" expanded="true" />
</folding>
......@@ -80,11 +80,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="market.py" pinned="false" current-in-tab="true">
<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.74371856" vertical-offset="775" max-vertical-offset="1173">
<caret line="63" column="57" selection-start-line="63" selection-start-column="57" selection-end-line="63" selection-end-column="57" />
<state vertical-scroll-proportion="0.0" vertical-offset="520" max-vertical-offset="1224">
<caret line="64" column="31" selection-start-line="64" selection-start-column="31" selection-end-line="64" selection-end-column="31" />
<folding>
<element signature="e#22#53#0" expanded="true" />
</folding>
......@@ -106,7 +106,7 @@
<entry file="file://$PROJECT_DIR$/user.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="809" max-vertical-offset="1207">
<caret line="10" column="7" selection-start-line="10" selection-start-column="7" selection-end-line="10" selection-end-column="7" />
<caret line="14" column="0" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
......@@ -122,9 +122,9 @@
<option value="$PROJECT_DIR$/tradebox.py" />
<option value="$PROJECT_DIR$/sclient.py" />
<option value="$PROJECT_DIR$/ssocketio.py" />
<option value="$PROJECT_DIR$/market.py" />
<option value="$PROJECT_DIR$/user.py" />
<option value="$PROJECT_DIR$/sconnectionhandler.py" />
<option value="$PROJECT_DIR$/market.py" />
</list>
</option>
</component>
......@@ -382,7 +382,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="true" 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="true" 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" />
......@@ -812,24 +812,6 @@
</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="3440" max-vertical-offset="8823">
<caret line="221" column="22" selection-start-line="221" selection-start-column="22" selection-end-line="221" selection-end-column="22" />
<folding>
<element signature="e#21#32#0" expanded="true" />
</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="809" max-vertical-offset="1207">
<caret line="10" column="7" selection-start-line="10" selection-start-column="7" selection-end-line="10" selection-end-column="7" />
<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="877" max-vertical-offset="1275">
......@@ -868,13 +850,31 @@
</entry>
<entry file="file://$PROJECT_DIR$/market.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.74371856" vertical-offset="775" max-vertical-offset="1173">
<caret line="63" column="57" selection-start-line="63" selection-start-column="57" selection-end-line="63" selection-end-column="57" />
<state vertical-scroll-proportion="0.0" vertical-offset="520" max-vertical-offset="1224">
<caret line="64" column="31" selection-start-line="64" selection-start-column="31" selection-end-line="64" selection-end-column="31" />
<folding>
<element signature="e#22#53#0" expanded="true" />
</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="809" max-vertical-offset="1207">
<caret line="14" column="0" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sconnectionhandler.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-0.76623374" vertical-offset="3525" max-vertical-offset="8823">
<caret line="190" column="56" selection-start-line="190" selection-start-column="56" selection-end-line="190" selection-end-column="56" />
<folding>
<element signature="e#21#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
......@@ -61,4 +61,7 @@ class Market:
@staticmethod
def dirty(item):
return int(time.time()) - Market.__time[item] > 0
\ No newline at end of file
print(int(time.time()) - Market.__time[item])
print(int(time.time()))
print(Market.__time[item])
return int(time.time()) - Market.__time[item] > 20
\ No newline at end of file
......@@ -187,13 +187,13 @@ class ConnectionHandler:
# do something
user = User(token)
if user.time < time.time():
(user.location.x, user.location.y) = (x, y);
user.time = int(time.time())+User.MOVE_TIME*(abs(int(user.location.x)-x)+abs(int(user.location.y)-y))
(user.location.x, user.location.y) = (x, y);
user.save()
data = json.dumps({'status': 'ok', 'time': user.time})
else:
data = json.dumps({'status': 'fail', 'description': 'need time'+str(user.time-time.time())})
data = json.dumps({'status': 'fail', 'description': 'need time '+str(user.time-time.time())})
try:
self._socketio.write_to_socket(data.encode('ascii'))
......
......@@ -15,7 +15,7 @@ class Location:
class User:
MOVE_TIME = 20
MOVE_TIME = 60
__users = MongoClient('localhost', 27017)['sister'].get_collection('users')
def __init__(self, id):
......
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