]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/results/List.js
sort open-async results, if allowed
[alttp.git] / resources / js / components / results / List.js
index 3d1bdfa8f27c9ff0147832934ce81975a8bee2c0..fb26fa56f264d94c2c393a6dc70af0e23dea91f3 100644 (file)
@@ -5,11 +5,14 @@ import Item from './Item';
 import { sortByFinished, sortByResult } from '../../helpers/Participant';
 import { maySeeResults } from '../../helpers/permissions';
 import { getRunners } from '../../helpers/Tournament';
+import { compareResult } from '../../helpers/Result';
 import { withUser } from '../../helpers/UserContext';
 
 const List = ({ round, tournament, user }) => {
        if (tournament.type === 'open-async') {
-               const results = round.results || [];
+               const results = maySeeResults(user, tournament, round)
+                       ? (round.results || []).sort(compareResult)
+                       : round.results || [];
                return <div className="results d-flex flex-wrap">
                        {results.map(result =>
                                <Item