mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Delete SURVEYS.CSV code
This commit is contained in:
parent
09aedecc3b
commit
5d89cf9474
@ -73,12 +73,6 @@ def controlPanel(request):
|
||||
|
||||
return render(request,'controlPanel.html', {'caves':Cave.objects.all(),'expeditions':Expedition.objects.all(),'jobs_completed':jobs_completed})
|
||||
|
||||
def downloadSurveys(request):
|
||||
from export import tosurveys
|
||||
response = HttpResponse(content_type='text/csv')
|
||||
response['Content-Disposition'] = 'attachment; filename=Surveys.csv'
|
||||
return response
|
||||
|
||||
def downloadLogbook(request,year=None,extension=None,queryset=None):
|
||||
|
||||
if year:
|
||||
|
@ -31,59 +31,6 @@ 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))
|
||||
@ -159,19 +106,6 @@ def listdir(*directories):
|
||||
# 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)
|
||||
|
@ -108,23 +108,6 @@
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user