-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Conflict Resolver] Reactify + DataFramework #5140
Conversation
Hi @xlecours I'm manually testing right now and I'm confused on how to save the Correct Answer in the Unresolved Conflicts panel. As an example I changed one of the values for the Correct Answer and I see the green checkbox but I don't see how to save it. Then after I visit the Resolved panel and I'm not seeing it when filtering for most recent Timestamp. |
@maltheism The save happen onChange automatically. The "Resolved" tab should update when you change tabs so the newly resolved conflict should appear right away. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- in
modules/conflict_resolver/php/conflict_resolver.class.inc
line 404:PhanUndeclaredStaticMethod Static call to undeclared method \NDB_Page::toArray
After fixing the requested changes locally, the module seemed to load and function normally.
A UI improvement could be done for the autosaved select elements, they show up like this on my chrome
modules/conflict_resolver/php/provisioners/resolvedprovisioner.class.inc
Outdated
Show resolved
Hide resolved
modules/conflict_resolver/php/provisioners/unresolvedprovisioner.class.inc
Outdated
Show resolved
Hide resolved
public function getCenterID(): int | ||
{ | ||
return (int) $this->centerid; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get projectId function should be added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To filter out other projects data, just like centerid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ridz1208 So what you are asking is for me to add the UserProjectMatch to the data provisioners here : https://github.com/aces/Loris/pull/5140/files#diff-8c4f9a1ba1e40de58508d6300ab817fcR136 and there : https://github.com/aces/Loris/pull/5140/files#diff-401ec2ff7b24354f8856d1462f4eb1f6R148
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ridz1208 Done
fix tests
@ridz suggestions Co-Authored-By: Rida Abou-Haidar <[email protected]>
@driusan This is passing Travis now. Ready for review |
public function getCenterID(): int | ||
{ | ||
return (int) $this->centerid; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To filter out other projects data, just like centerid
@ridz1208 Done. Please re-review |
* | ||
* @param {Event} e - The onChange event. | ||
*/ | ||
fix(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest having this function alter the DOM via a state change, rather than altering the element directly. That way you can also use the LORIS SelectElement
rather than a custom element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you care to propose something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You suggestion must:
- send a post request to
/conflict_resolver/unresolved
with{conflictid: conflictid, correctanswer: correctanswer}
- display feedback to the user for each resolved conflict.
- remove the empty option in the select options when a conflict is resolved because it can be re-resolved with an other answer but not bring back as unresolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
- This wouldn't have to change. The
fix
function could still post the request the same way you are currently doing it. - The
fix
function would call a function that will have been passed by the parent via props and pass anid
that indicates which row of the datatable it corresponds to. This callback function would then trigger a state change in the parent indexed by the rowid
which would display the appropriate feedback to the user for that given datatable row in theformatColumn
function ofunresolved_filterabledatatable.js
. - You could use the same state from (2) to conditionally remove the empty option when a conflict has been resolved. There's a prop you can pass to
SelectElement
s calledemptyOption
that determines whether there is an empty option or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HenriRabalais Would you care to propose something? (I mean code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to commit code to your PR? I don't think pasting code here would do much good since it's out of the context of the PR, and my previous response are instructions for the code I'm proposing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending a PR to my branch would do the trick.
@HenriRabalais @xlecours do we know how close this is to being mergeable ? other than conflicts and travis ? |
@ridz1208 I completely agree with @HenriRabalais but I don't have time at the moment to look into it. The current state is working but it is not following React best practices. I will fix the conflicts If @HenriRabalais can send a PR to my branch with his requested changes implemented, I will gladly merge it. |
This PR was 90% there, a new PR has been issued. May it RIP |
I sent HenriRabalais#7 to fix the thing. There is still an issue with the selected option after the fix. |
The frontend and the backend follows the same structure; There is a Conflict_resolver React app that renders a
<FilterableDatatable>
for unresolved or resolved conflict according to the selected tab.This React app is provided by the conflict_resolver.class.inc php file along with all the CSS and other JS. The rendered
<FilterableDatatable>
will the make a fetch (GET) call to either conflict_resolver/unresolved or conflict_resolver/resolved that correspond to 2 RequestHandlers with the same name. Each handler will then process the request and return the data and the filterOptions.The conflict_resolver/unresolved endpoint also support POST request with conflict_id and correct_answer to resolve a conflict. As long as the page is not refreshed, it is possible to fix a conflict multiple time; each time changing the values in the "wrong" instrument, recalculate score, inserting/replacing the row in conflicts_resolved and removing the row in conflicts_unresolved if not already removed.
A UNIQUE constraint is added on ConflictID in conflicts_resolved table to allow REPLACE sql statement to work when a conflict is resolved then corrected.
Still missing:
Bonus:
This provide a new database provisioner,
src/Data/Provisioners/DBObjectProvisioner.php
, that returns a Traversable of objects of a given class by using PDOStatement::setFetchMode( PDO::FETCH_CLASS). Basically, each rows are transformed from an associative array to an object with column names as properties. (see unresolveddto.class.inc and resolveddto.class.inc)This also adds a open-api spec schema.yml file in the
static
directory of the module to view the endpoitns in swagger-ui.