vsoch / freegenes

FreeGenes BioNode with Django
https://vsoch.github.io/freegenes/
Mozilla Public License 2.0
2 stars 4 forks source link

After first order, pop up says 'You do not have an active order' #143

Closed Koeng101 closed 4 years ago

Koeng101 commented 4 years ago

Describe the bug After I submitted my first order on Koeng102 (test account), I was redirected to https://freegenes.dev/o/ with a pop up that said 'You do not have an active order'. It also did not update the 'Date Ordered' column for the order that I did see (which is what I just placed).

To Reproduce Order something on a new account on FreeGenes.dev

Expected behavior A confirmation that my order was ordered, and for the Date Ordered column to be updated.

If applicable, add versions and screenshots to help explain your problem. 2019-11-12-104234_3840x1080_scrot

vsoch commented 4 years ago

The active order is for a cart, so once you submit, it's correct that you don't have an active order. I'll update the text there.

For the date_ordered, that field has been used to indicate when the order is actually done (e.g., when the label is generated) and then date_shipped is when Hannah clicks "Mark as Shipped." If you'd like to change this standard we should probably check with @hverdonk first.

Koeng101 commented 4 years ago

@hverdonk what do you think about updating the date_ordered column

vsoch commented 4 years ago

Also we have:

which are auto populated for creation and update. The date_ordered is specific to creating the label, and date_shipped is for shipped.

Koeng101 commented 4 years ago

But then date_ordered doesn't mean date_ordered, it means date_label_generated. I think from the user side, time_created makes much more sense, since they probably don't really care when the label is generated.

vsoch commented 4 years ago

If Hannah is ok with it, I agree that date_ordered more cleanly lines up with when the order was submit, and we should update the server to populate that field at this time.

hverdonk commented 4 years ago

I agree, we should change date_ordered to refer to the time when the user submits a request

vsoch commented 4 years ago

Thanks @hverdonk - I'll get this change in first thing tomorrow!

vsoch commented 4 years ago

okay! Just found the bug here - I implemented the function correctly, but used a hard coded string instead of the variable

            # If a new status is requested, countersigned MTA letter has been uploaded
            if updated_status is not None:
                order.status = "Generating Label"
            order.save()

The function call for the admin view (note switches to Generating Label)

        return _upload_mta(request, uuid, 
                           template='orders/upload-mta.html',
                           redirect_checkout=False,
                           updated_status="Generating label",
                           email_to=HELP_CONTACT_EMAIL)

and for the user, should switch back to Awaiting Countersign

    # In this case, if a user re-uploads an MTA (and it needs to again be
    # countersigned) we revert the status back to Awaiting Countersign
    return _upload_mta(request, uuid, updated_status="Awaiting Countersign")

so the fix was just honoring that variable!

            # If a new status is requested, countersigned MTA letter has been uploaded
            if updated_status is not None:
                order.status = updated_status
            order.save()

We can definitely chock this one up to Vanessa brain fart / other slip in reality :) Will get changes in soon, along with updating the date_ordered.

vsoch commented 4 years ago

okay all set!