Skip to content

Commit

Permalink
Fix problem on change of year
Browse files Browse the repository at this point in the history
  • Loading branch information
j-santander committed Dec 1, 2015
1 parent a831f4d commit 3a4d30e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions logic/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ def modify(self, operations, partial):
last_text = ""
today = datetime.datetime.now(tz=self.met)
for i in sorted(operations):
if (i.month - today.month) not in (0, 1):
if(i.month==1 and today.month==12):
mes = 1
else:
mes = i.month - today.month
if mes not in (0, 1):
L.error(str(i) + " is neither current nor next month")
partial(str(i) + " no es parte del mes actual o siguiente")
continue
Expand All @@ -149,7 +153,7 @@ def modify(self, operations, partial):
L.debug("Requesting " + str(i) + ": " + self.map_operation(operations[i]))
r = self.session.post("http://" + self.host + "/perfil.php", data={
"dia": i.day,
"mes": i.month - today.month,
"mes": mes,
"libre": operations[i],
})

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

__version__ = '0.5'
__version__ = '0.5.1'

import kivy

Expand Down
6 changes: 5 additions & 1 deletion service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ def update_pending(self, result):

for i in sorted(self.pending):
today = datetime.datetime.now(tz=self.met)
if (i.month - today.month) not in (0, 1):
if(i.month==1 and today.month==12):
mes = 1
else:
mes = i.month - today.month
if mes not in (0, 1):
L.error(str(i) + " is neither current nor next month")
to_delete.append(i)
continue
Expand Down

0 comments on commit 3a4d30e

Please sign in to comment.