Skip to content

Commit

Permalink
Merge pull request #459 from ManojNathIC/polls
Browse files Browse the repository at this point in the history
Task #0000:Updated Auto poll published
  • Loading branch information
ManojNathIC authored Aug 8, 2024
2 parents b4485c3 + 30cfac8 commit 50a5506
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/nulp_elite/src/pages/voting/createForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const createForm = () => {
visibility,
poll_options: pollOptions,
poll_keywords: chips,
status: "Draft",
status: "Live",
start_date: startDate,
end_date: endDate,
user_list: userListFinal,
Expand All @@ -223,7 +223,7 @@ const createForm = () => {
visibility,
poll_options: pollOptions,
poll_keywords: chips,
status: "Draft",
status: "Live",
start_date: startDate,
end_date: endDate,
user_list: userList,
Expand Down
6 changes: 3 additions & 3 deletions packages/nulp_elite/src/pages/voting/votingDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const VotingDetails = () => {
const [currentTime, setCurrentTime] = useState(moment());
const [startDate, setStartDate] = useState(moment());
const [endDate, setEndDate] = useState(moment());
const [updateFlag, setUpdateFlag] = useState({ live: false, closed: false });
const [updateFlag, setUpdateFlag] = useState(false);

useEffect(() => {
const timer = setInterval(() => {
Expand Down Expand Up @@ -124,13 +124,13 @@ const VotingDetails = () => {
useEffect(() => {
// Ensure startDate is parsed as UTC and then converted to local time
const startDateLocal = moment.utc(startDate).local();

console.log("startDate:----", startDateLocal);
// Check if the current time has passed the start date
if (moment().isAfter(startDateLocal)) {
if (!updateFlag) {
setUpdateFlag(true);
// Send update to the backend
fetch(`http://localhost:3000/polls/update?poll_id=${pollId}`, {
fetch(`${urlConfig.URLS.POLL.UPDATE}?poll_id=${pollId}`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Expand Down

0 comments on commit 50a5506

Please sign in to comment.