Skip to content

Commit

Permalink
Merge pull request #342 from manipalutsav/testing
Browse files Browse the repository at this point in the history
  • Loading branch information
abhikpai committed Mar 31, 2024
2 parents 717722e + cd1fbae commit 343445c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/commons/Sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const SidebarItems = ({ backupName, backupData }) => {
<SidebarItem to="/teams" title="TEAMS" />
<SidebarItem to="/slots" title="SLOTS" />
<SidebarItem to="/volunteers" title="VOLUNTEERS" />
{/* <SidebarItem to="/leaderboard/public" title="EVENT STANDINGS" /> */}
<SidebarItem to="/leaderboard/public" title="EVENT STANDINGS" />
<SidebarItem to="/practice-slots/public" title="PRACTICE SLOTS" />
{/* <SidebarItem to="/certificates" title="Certificates" /> */}
<SidebarSeparator />
Expand Down Expand Up @@ -152,7 +152,7 @@ const SidebarItems = ({ backupName, backupData }) => {
Feedback
</a>
</li> */}
{/* <SidebarItem to="/stats" title="Stats" /> */}
<SidebarItem to="/stats" title="Stats" />
{isAdmin && (<a href={backupData} download={backupName}>
<div css={{
display: "block",
Expand Down
14 changes: 12 additions & 2 deletions src/components/CollegeTeams/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import participantsService from "../../services/participants";

import { Button } from "../../commons/Form";
import { toast } from "../../actions/toastActions";
import { isTeamChangeFreezed } from "../../utils/common";
import { getSetting } from "../../services/settingsServices";

export default class EditMember extends React.Component {
UPDATE = "Update";
Expand All @@ -14,6 +14,7 @@ export default class EditMember extends React.Component {
state = {
buttonText: this.UPDATE,
participant: {},
teamEditEnabled: false,
};

handleChange = (e) => {
Expand Down Expand Up @@ -44,14 +45,23 @@ export default class EditMember extends React.Component {

this.setState({ participant: participant || {} })
});

getSetting("editTeamEnabled").then((data)=>{
if(data)
{
this.setState({teamEditEnabled: data})
}else{
this.setState({teamEditEnabled: false})
}
});
}

render = () => (
<div>
<div>
<h2 className="mucapp">Edit Participant {this.state.participant.name}</h2>
</div>
{!isTeamChangeFreezed() ? (<div>
{this.state.teamEditEnabled ? (<div>
<div>
<div>Name</div>
<input
Expand Down
11 changes: 7 additions & 4 deletions src/components/CollegeTeams/rankings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class Teams extends React.Component {
}
init = async () => {
let user = getUser();
let response = await collegesService.getAllEventRankings(user.college);
let response = await collegesService.getPublishedEventRankings(user.college);
let college = await collegesService.get(user.college);
console.log(response);
this.setState({ ranks: response, college, showLoader: false })
Expand All @@ -36,11 +36,14 @@ export default class Teams extends React.Component {
</tr>
</thead>
<tbody>
{this.state.ranks.map(eventRanks => <tr>
{this.state.ranks.map(eventRanks => {
console.log(eventRanks)
return <tr>
<td><Link to={`/events/${eventRanks.event._id}/rounds/${eventRanks.event.rounds.pop()}/leaderboard`}>{eventRanks.event.name}</Link></td>
{/* uncomment this to show ranks to public */}
{/* <td>{eventRanks.ranks.map(rank => <span className="pr-5">#{rank.rank}</span>)}</td> */}
</tr>)}
<td>{eventRanks.ranks.map(rank => <span className="pr-5">#{rank.rank}</span>)}</td>
</tr>
})}
</tbody>
</table>
</LoadContent>)
Expand Down
18 changes: 17 additions & 1 deletion src/services/colleges.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ const getAllEventRankings = async (collegeID) => {
return [];
}
};

const getPublishedEventRankings = async (collegeID) => {
let response;
if (collegeID)
response = await request("/colleges/" + collegeID + "/public-rankings");

if (response && response.status === 200) {
return response.data;
} else {
if (response && response.status === "401")
toast("Your session has expired, please logout and login again.")
return [];
}
};

export default {
create,
update,
Expand All @@ -131,5 +146,6 @@ export default {
getTeams,
getParticipants,
getCollege,
getAllEventRankings
getAllEventRankings,
getPublishedEventRankings,
};

0 comments on commit 343445c

Please sign in to comment.