date_tested=date,
            result=None,
            temperature=-999,
            humidity=-999,
            log_file=path,
            hidden_log_file=path,
        )

    else:
        temp_attempt = Attempt(
            card=card,
            plane_loc="default",
            test_type=temp_test,
            attempt_number=attempt_num,
            tester=tester,
            date_tested=date,
            result=0,
            temperature=-999,
            humidity=-999,
            log_file=path,
            hidden_log_file=path,
        )

    for attempt in prev_attempts:
        attempt.revoked = True
        attempt.save()

    temp_attempt.save()

set_card_status(card)
Ejemplo n.º 2
0
#source_dir = os.path.join(run_control, (run + "_output/QC_" + run + "/"))    # temp directory for all the uploaded qie cards

new_dir_name = os.path.basename(makeOutputPath(rawUID, destination))    # permanent storage for qie card data. i.e media/uploads/0700001/0x1111111_0x1234567_v2 if this is the second upload

#new_dir_name = rawUID + "_QC_" + run    # what the new directories will be called i.e. 0x11111111_0x2124124124_QC_run350

old_src_name = os.path.dirname(file_name) #os.path.join(temp_card_dir, rawUID)    # where the temporary storage is for the UID directories
new_src_name = os.path.join(temp_card_dir, new_dir_name)    # where the permanent storage will be for the UID directories

file_name = os.path.basename(file_name) # only grab the basename from the full path for the JSON file

# Rename the UID Directory name
os.renames(old_src_name, new_src_name)

# Move UID Directory to its permanent storage
shutil.move(new_src_name, destination)

mved_src_name = os.path.join(destination, new_dir_name)

new_file_name = os.path.join(mved_src_name, file_name)

#media = os.path.join("uploads/qieCards/", qiecard.barcode, os.path.basename(mved_src_name))
json_file = os.path.join("uploads/qieCards/", qiecard.barcode, os.path.basename(mved_src_name), file_name)
cmd_file = os.path.join("uploads/qieCards/", qiecard.barcode, os.path.basename(mved_src_name), "cmd.log")
run_file = os.path.join("uploads/qieCards/", qiecard.barcode, os.path.basename(mved_src_name), "run.log")

uploadAttempt(attemptlist, json_file, cmd_file, run_file)    #, channels_passed, channels_failed)

set_card_status(qiecard)

Ejemplo n.º 3
0
overwrite = cardData["Overwrite"]

# Upload data to the database
qie = loadCard(cardData, overwrite)

#load time of test
date = cardData["DateRun"] + "-05:00"

#find tester account
try:
    tester = Tester.objects.get(username=cardData["User"])
except:
    sys.exit("Tester %s not valid" % cardData["User"])

newPath = moveJsonFile(qie, fileName, overwrite)
qie.save()

attempts = loadTests(qie, tester, date, cardData["testResults"], newPath,
                     overwrite)

if not overwrite:
    location = setLocation(qie, date)
    location.save()

for attempt in attempts:
    attempt.comments = cardData["TestComment"]
    attempt.save()

set_card_status(qie)