mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-29 21:31:54 +00:00
Delete SURVEYS.CSV code
This commit is contained in:
parent
d5b4a0b1d9
commit
43394facdf
@ -71,20 +71,6 @@ def controlPanel(request):
|
||||
|
||||
return render(request,'controlPanel.html', {'caves':Cave.objects.all(),'expeditions':Expedition.objects.all(),'jobs_completed':jobs_completed})
|
||||
|
||||
def downloadCavetab(request):
|
||||
from export import tocavetab
|
||||
response = HttpResponse(content_type='text/csv')
|
||||
response['Content-Disposition'] = 'attachment; filename=CAVETAB2.CSV'
|
||||
tocavetab.writeCaveTab(response)
|
||||
return response
|
||||
|
||||
def downloadSurveys(request):
|
||||
from export import tosurveys
|
||||
response = HttpResponse(content_type='text/csv')
|
||||
response['Content-Disposition'] = 'attachment; filename=Surveys.csv'
|
||||
tosurveys.writeCaveTab(response)
|
||||
return response
|
||||
|
||||
def downloadLogbook(request,year=None,extension=None,queryset=None):
|
||||
|
||||
if year:
|
||||
|
@ -29,67 +29,14 @@ def get_or_create_placeholder(year):
|
||||
placeholder_logbook_entry, newly_created = save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs)
|
||||
return placeholder_logbook_entry
|
||||
|
||||
# obsolete surveys.csv does not exist.
|
||||
# def readSurveysFromCSV():
|
||||
# try: # could probably combine these two
|
||||
# surveytab = open(os.path.join(settings.SURVEY_SCANS, "Surveys.csv"))
|
||||
# except IOError:
|
||||
# import io, urllib.request, urllib.parse, urllib.error
|
||||
# surveytab = io.StringIO(urllib.request.urlopen(settings.SURVEY_SCANS + "/Surveys.csv").read())
|
||||
# dialect=csv.Sniffer().sniff(surveytab.read())
|
||||
# surveytab.seek(0,0)
|
||||
# surveyreader = csv.reader(surveytab,dialect=dialect)
|
||||
# headers = next(surveyreader)
|
||||
# header = dict(list(zip(headers, list(range(len(headers)))))) #set up a dictionary where the indexes are header names and the values are column numbers
|
||||
|
||||
# # test if the expeditions have been added yet
|
||||
# if Expedition.objects.count()==0:
|
||||
# print("There are no expeditions in the database. Please run the logbook parser.")
|
||||
# sys.exit()
|
||||
|
||||
|
||||
# logging.info("Deleting all scanned images")
|
||||
# ScannedImage.objects.all().delete()
|
||||
|
||||
|
||||
# logging.info("Deleting all survey objects")
|
||||
# Survey.objects.all().delete()
|
||||
|
||||
|
||||
# logging.info("Beginning to import surveys from "+str(os.path.join(settings.SURVEYS, "Surveys.csv"))+"\n"+"-"*60+"\n")
|
||||
|
||||
# for survey in surveyreader:
|
||||
# #I hate this, but some surveys have a letter eg 2000#34a. The next line deals with that.
|
||||
# walletNumberLetter = re.match(r'(?P<number>\d*)(?P<letter>[a-zA-Z]*)',survey[header['Survey Number']])
|
||||
# # print(walletNumberLetter.groups())
|
||||
# year=survey[header['Year']]
|
||||
|
||||
|
||||
# surveyobj = Survey(
|
||||
# expedition = Expedition.objects.filter(year=year)[0],
|
||||
# wallet_number = walletNumberLetter.group('number'),
|
||||
# logbook_entry = get_or_create_placeholder(year),
|
||||
# comments = survey[header['Comments']],
|
||||
# location = survey[header['Location']]
|
||||
# )
|
||||
# surveyobj.wallet_letter = walletNumberLetter.group('letter')
|
||||
# if survey[header['Finished']]=='Yes':
|
||||
# #try and find the sketch_scan
|
||||
# pass
|
||||
# surveyobj.save()
|
||||
|
||||
|
||||
# logging.info("added survey " + survey[header['Year']] + "#" + surveyobj.wallet_number + "\r")
|
||||
|
||||
# dead
|
||||
# def listdir(*directories):
|
||||
# try:
|
||||
# return os.listdir(os.path.join(settings.SURVEYS, *directories))
|
||||
# except:
|
||||
# import urllib.request, urllib.parse, urllib.error
|
||||
# url = settings.SURVEYS + reduce(lambda x, y: x + "/" + y, ["listdir"] + list(directories))
|
||||
# folders = urllib.request.urlopen(url.replace("#", "%23")).readlines()
|
||||
# return [folder.rstrip(r"/") for folder in folders]
|
||||
def listdir(*directories):
|
||||
try:
|
||||
return os.listdir(os.path.join(settings.SURVEYS, *directories))
|
||||
except:
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
url = settings.SURVEYS + reduce(lambda x, y: x + "/" + y, ["listdir"] + list(directories))
|
||||
folders = urllib.request.urlopen(url.replace("#", "%23")).readlines()
|
||||
return [folder.rstrip(r"/") for folder in folders]
|
||||
|
||||
# add survey scans
|
||||
# def parseSurveyScans(expedition, logfile=None):
|
||||
@ -157,19 +104,6 @@ def get_or_create_placeholder(year):
|
||||
# yearPath=os.path.join(settings.SURVEY_SCANS, "surveyscans", expedition.year)
|
||||
# print((" ! No folder found for " + expedition.year + " at:- " + yearPath))
|
||||
|
||||
# dead
|
||||
# def parseSurveys(logfile=None):
|
||||
# try:
|
||||
# readSurveysFromCSV()
|
||||
# except (IOError, OSError):
|
||||
# print(" ! Survey CSV not found..")
|
||||
# pass
|
||||
|
||||
# print(" - Loading scans by expedition year")
|
||||
# for expedition in Expedition.objects.filter(year__gte=2000): #expos since 2000, because paths and filenames were nonstandard before then
|
||||
# print("%s" % expedition, end=' ')
|
||||
# parseSurveyScans(expedition)
|
||||
|
||||
# dead
|
||||
# def isInterlacedPNG(filePath): #We need to check for interlaced PNGs because the thumbnail engine can't handle them (uses PIL)
|
||||
# file=Image.open(filePath)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
{% if error %}
|
||||
<div class="noticeBox">
|
||||
{{ error }}
|
||||
{{ error }}
|
||||
<a href="#" class="closeDiv">dismiss this message</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -96,61 +96,44 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
surveys to Surveys.csv
|
||||
<td>
|
||||
surveys to Surveys.csv
|
||||
</td>
|
||||
<td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<form name="export" method="get" action={% url "downloadlogbook" %}>
|
||||
<p>Download a logbook file which is dynamically generated by Troggle.</p>
|
||||
|
||||
<p>Download a logbook file which is dynamically generated by Troggle.</p>
|
||||
|
||||
<p>
|
||||
Expedition year:
|
||||
<select name="year">
|
||||
{% for expedition in expeditions %}
|
||||
<option value="{{expedition}}"> {{expedition}} </option>
|
||||
<option value="{{expedition}}"> {{expedition}} </option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Output style:
|
||||
<select name="extension">
|
||||
<option value="txt">.txt file with MediaWiki markup - 2008 style</option>
|
||||
<option value="html">.html file - 2005 style</option>
|
||||
<select name="extension">
|
||||
<option value="txt">.txt file with MediaWiki markup - 2008 style</option>
|
||||
<option value="html">.html file - 2005 style</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input name="download_logbook" type="submit" value="Download logbook" />
|
||||
</p>
|
||||
</form>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
surveys to Surveys.csv
|
||||
</td>
|
||||
<td>
|
||||
<form name="export" method="post" action="">
|
||||
<p>Overwrite the existing Surveys.csv file with one generated by Troggle.</p>
|
||||
<input disabled name="export_surveys" type="submit" value="Update {{settings.SURVEYS}}noinfo/Surveys.csv" />
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form name="export" method="get" action={% url "downloadsurveys" %}>
|
||||
<p>Download a Surveys.csv file which is dynamically generated by Troggle.</p>
|
||||
<input disabled name="download_surveys" type="submit" value="Download Surveys.csv" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>qms to qms.csv</td><td>
|
||||
<form name="export_qms" method="get" action="downloadqms">
|
||||
|
||||
<form name="export_qms" method="get" action="downloadqms">
|
||||
|
||||
<!--This is for choosing caves by area (drilldown).
|
||||
|
||||
<select id="qmcaveareachooser" class="searchable" >
|
||||
@ -158,12 +141,12 @@
|
||||
|
||||
-->
|
||||
|
||||
Choose a cave.
|
||||
Choose a cave.
|
||||
<select name="cave_id" id="qmcavechooser">
|
||||
|
||||
{% for cave in caves %}
|
||||
<option value="{{cave.kataster_number}}">{{cave}}
|
||||
</option>
|
||||
</option>
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
@ -174,4 +157,4 @@
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user