Skip to content

Add module display name to module related server events - #2696

Merged
mulby merged 1 commit into
openedx:masterfrom
mulby:gabe/add-problem-name-to-events
Feb 25, 2014
Merged

Add module display name to module related server events#2696
mulby merged 1 commit into
openedx:masterfrom
mulby:gabe/add-problem-name-to-events

Conversation

@mulby

@mulby mulby commented Feb 24, 2014

Copy link
Copy Markdown
Contributor

This information will likely be used frequently for analytics purposes, so we would like to denormalize here to avoid having to join with the modulestore later.

We would like this feature to make it in to the release tomorrow.

A few notes:

  • Wasn't sure where the best place to put this logic is. Very open to suggestions.
  • I figured the best way to communicate what we are trying to do was to submit a diff. I'm not attached to any of this.
  • Once the approach is approved, I'll nail it down with some tests etc.

Fixes: AN-594
Reviewers: @cpennington, @rocha, @brianhw

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where to put this exactly. I need to wrap the execution of the module logic from a location where I have easy access to the "display_name_with_default" information. I'm fine moving this anywhere really.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right to me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if the context is only for instance.handle?

with tracker.context(...):
  resp = instance.handle(handler, req, suffix)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I like that better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the context named with the id of the block? It seems like both the id and the display_name should be part of a context named something like 'xblock'. Although, maybe that's just me not knowing how your contexts work?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... it's to handle nesting, isn't it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it's worth noting that this doesn't wrap any of the view execution (rendering student_view). This is only wrapping xblock handlers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's to handle nesting. I'm not sure if this function can be called multiple times in the same request, but if it can, say on parent and child xblocks, then I'd rather not overwrite the parent context when this is called for the child. If they have different names, then it is smart enough to "push" the child context on top of the stack and it's keys will override the parent context, however, when the child context is exited, the parent values will still be there.

If, however, this function is only called once per request, then it should be safe to use the same name.

At a minimum I should probably put in a comment to this effect since it's non-obvious.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better place to wrap that would ensure the context was populated for both views and handlers?

@brianhw

brianhw commented Feb 24, 2014

Copy link
Copy Markdown
Contributor

LGTM. 👍

@mulby

mulby commented Feb 24, 2014

Copy link
Copy Markdown
Contributor Author

@cpennington @rocha - let me know if this is good to merge, we would like to get it in to the release tomorrow.

@rocha

rocha commented Feb 25, 2014

Copy link
Copy Markdown
Contributor

🚀

@mulby

mulby commented Feb 25, 2014

Copy link
Copy Markdown
Contributor Author

Rebased and squashed on to the tip of master. @cpennington - we are planning on cherry picking this commit on to the release branch, but don't want to do so without your approval. Let me know what you think.

@mulby

mulby commented Feb 25, 2014

Copy link
Copy Markdown
Contributor Author

@cpennington we decided not to ship this with the release, so the pressure is off for the time being.

@mulby

mulby commented Feb 25, 2014

Copy link
Copy Markdown
Contributor Author

Updated to use a static context name

This information will likely be used frequently for analytics purposes, so we would like to denormalize here to avoid having to join with the modulestore later.

Fixes: AN-594
@cpennington

Copy link
Copy Markdown
Contributor

👍

mulby added a commit that referenced this pull request Feb 25, 2014
Add module display name to module related server events
@mulby
mulby merged commit 8ff3b4e into openedx:master Feb 25, 2014
@mulby
mulby deleted the gabe/add-problem-name-to-events branch February 25, 2014 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants