Commit 750d8e98 authored by Marc Duez's avatar Marc Duez
Browse files

server : birth date and sample date are no longer required

parent 0a93c832
...@@ -43,7 +43,7 @@ def logger(): ...@@ -43,7 +43,7 @@ def logger():
log.log(lvl, res) log.log(lvl, res)
def init_db(force=False): def init_db(force=False):
if (db(db.auth_user.id > 0).count() == 0) or (force) : if (force) or (db(db.auth_user.id > 0).count() == 0) :
for table in db : for table in db :
table.truncate() table.truncate()
......
...@@ -36,11 +36,11 @@ def add_form(): ...@@ -36,11 +36,11 @@ def add_form():
import shutil, os.path, datetime import shutil, os.path, datetime
error = "" error = ""
if request.vars['sampling_date'] != None : if request.vars['sampling_date'] != '' :
try: try:
datetime.datetime.strptime(""+request.vars['sampling_date'], '%Y-%m-%d') datetime.datetime.strptime(""+request.vars['sampling_date'], '%Y-%m-%d')
except ValueError: except ValueError:
error += "date missing or wrong format, " error += "date (wrong format), "
if request.vars['filename'] == None : if request.vars['filename'] == None :
error += " missing filename" error += " missing filename"
...@@ -98,6 +98,11 @@ def edit_form(): ...@@ -98,6 +98,11 @@ def edit_form():
error += "missing id" error += "missing id"
if request.vars['filename'] == None : if request.vars['filename'] == None :
error += " missing filename" error += " missing filename"
if request.vars['sampling_date'] != '' :
try:
datetime.datetime.strptime(""+request.vars['sampling_date'], '%Y-%m-%d')
except ValueError:
error += "date (wrong format), "
if error=="" : if error=="" :
mes = "file " + str(request.vars['id']) + " : " mes = "file " + str(request.vars['id']) + " : "
......
...@@ -439,10 +439,11 @@ def add_form(): ...@@ -439,10 +439,11 @@ def add_form():
error += "first name needed, " error += "first name needed, "
if request.vars["last_name"] == "" : if request.vars["last_name"] == "" :
error += "last name needed, " error += "last name needed, "
try: if request.vars["birth"] != "" :
datetime.datetime.strptime(""+request.vars['birth'], '%Y-%m-%d') try:
except ValueError: datetime.datetime.strptime(""+request.vars['birth'], '%Y-%m-%d')
error += "date missing or wrong format" except ValueError:
error += "date (wrong format)"
if error=="" : if error=="" :
id = db.patient.insert(first_name=request.vars["first_name"], id = db.patient.insert(first_name=request.vars["first_name"],
...@@ -504,10 +505,11 @@ def edit_form(): ...@@ -504,10 +505,11 @@ def edit_form():
error += "first name needed, " error += "first name needed, "
if request.vars["last_name"] == "" : if request.vars["last_name"] == "" :
error += "last name needed, " error += "last name needed, "
try: if request.vars["birth"] != "" :
datetime.datetime.strptime(""+request.vars['birth'], '%Y-%m-%d') try:
except ValueError: datetime.datetime.strptime(""+request.vars['birth'], '%Y-%m-%d')
error += "date missing or wrong format" except ValueError:
error += "date (wrong format)"
if request.vars["id"] == "" : if request.vars["id"] == "" :
error += "patient id needed, " error += "patient id needed, "
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<tr> <tr>
<td><label for="sampling_date" id="sampling_date__label">sampling date: </label></td> <td><label for="sampling_date" id="sampling_date__label">sampling date: </label></td>
<td><input class="date" id="sampling_date" name="sampling_date" type="text" value=""> <td><input class="date" id="sampling_date" name="sampling_date" type="text" value="">
<span>* (format: yyyy-mm-dd)</span></td> <span>(format: yyyy-mm-dd)</span></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -24,7 +24,7 @@ info = db.sequence_file[request.vars["id"]] ...@@ -24,7 +24,7 @@ info = db.sequence_file[request.vars["id"]]
<tbody> <tbody>
<tr> <tr>
<td> <label for="sampling_date" id="sampling_date__label">sampling date: </label> </td> <td> <label for="sampling_date" id="sampling_date__label">sampling date: </label> </td>
<td> <input class="date" id="sampling_date" name="sampling_date" type="text" value="{{=info.sampling_date}}"> <span>* (format: yyyy-mm-dd)</span> </td> <td> <input class="date" id="sampling_date" name="sampling_date" type="text" value="{{=info.sampling_date}}"> <span>(format: yyyy-mm-dd)</span> </td>
<td> </td> <td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</tr> </tr>
<tr> <tr>
<td><label for="patient_birth" id="patient_birth__label">Birth: </label></td> <td><label for="patient_birth" id="patient_birth__label">Birth: </label></td>
<td><input class="date" id="patient_birth" name="birth" type="text" value=""><span>* (format: yyyy-mm-dd)</span></td> <td><input class="date" id="patient_birth" name="birth" type="text" value=""><span>(format: yyyy-mm-dd)</span></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -25,7 +25,7 @@ info = db.patient[request.vars["id"]] ...@@ -25,7 +25,7 @@ info = db.patient[request.vars["id"]]
</tr> </tr>
<tr> <tr>
<td> <label for="patient_birth" id="patient_birth__label">Birth: </label></td> <td> <label for="patient_birth" id="patient_birth__label">Birth: </label></td>
<td> <input class="date" id="patient_birth" name="birth" type="text" value="{{=info.birth}}"><span>* (yyyy-mm-dd)</span></td> <td> <input class="date" id="patient_birth" name="birth" type="text" value="{{=info.birth}}"><span>(yyyy-mm-dd)</span></td>
<td> </td> <td> </td>
</tr> </tr>
<tr> <tr>
......
Markdown is supported
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